Giter Club home page Giter Club logo

pathname3's Introduction

= pathname3

This library is a replacement for the venerable pathname and pathname2
libraries.

The original implementation of pathname is extremely slow, and
instantiates extreme numbers of objects for relatively simple operations.
Twenty or so Pathname instantiations on some method calls is relatively
common.

An implementation by Daniel J. Berger, pathname2, improved on the original
significantly, adding Windows support, a Facade implementation, and a String-
based implementation. While his version is faster, it's still very slow at
instantiation. And its Facade implementation misses some odd case methods
like Pathname#join.

This version will focus on being fast and lightweight, while still being pure
Ruby. Windows support will be forthcoming once I have access to a Windows
development machine. Until then, patches adding Windows compatibility are
welcome.

== Installation

You can install pathname3 through Rubygems. The gem is hosted on GitHub, and
can be installed via

  $ sudo gem install --source http://gems.github.com/ stouset-pathname3

== Usage

  require 'pathname3'

  p = '~/foo'.to_path # => "~/foo"
  p.absolute?         # => false
  p.relative?         # => true
  p.exists?           # => false

  p = p.absolute                   # => "/Users/stouset/foo"
  p.absolute?                      # => true
  p.relative?                      # => false
  p.relative_path_from('/Users')   # => "stouset/foo"
  p.relative_path_from('/Library') # => "../Users/stouset/foo"
  p.split                          # => ["/Users/stouset", "foo"]
  p.touch                          # => "/Users/stouset/foo"
  p.ctime                          # => Thu Jun 05 14:00:01 -0400 2008
  p.delete                         # => true
  
== Contribution

The pathname3 project is hosted on GitHub.

  http://github.com/stouset/pathname3/

To clone the repository, simply run:

  git clone git://github.com/stouset/pathname3.git

== License

pathname3 is available under the MIT license.

:include: LICENSE

pathname3's People

Contributors

stouset avatar eventualbuddha avatar

Watchers

John Labovitz avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.