Sha256: 87ec9dff56671e80b825a8c3e28ad787b8c13f85465c3b9120a7506f6e8367f9

Contents?: true

Size: 626 Bytes

Versions: 8

Compression:

Stored size: 626 Bytes

Contents

class FSPath < Pathname
  class << self
    # return current user home path if called without argument
    # if called with argument return specified user home path
    def ~(name = nil)
      new(File.expand_path("~#{name}"))
    end
  end

  # join paths using File.join
  def /(other)
    self.class.new(File.join(@path, other.to_s))
  end

  # fixing Pathname.+
  def +(part)
    self.class.new(super + part)
  end

  if RUBY_PLATFORM.downcase.include?('darwin')
    def darwin!
      p :darwin
    end
  end
end

module Kernel
  # FSPath(path) method
  def FSPath(path)
    FSPath.new(path)
  end
  private :Pathname
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fspath-0.0.2.5-darwin lib/fspath.rb
fspath-0.0.2.5 lib/fspath.rb
fspath-0.0.2.4 lib/fspath.rb
fspath-0.0.2.4-darwin lib/fspath.rb
fspath-0.0.2.3-darwin lib/fspath.rb
fspath-0.0.2.2-darwin lib/fspath.rb
fspath-0.0.2 lib/fspath.rb
fspath-0.0.2-darwin lib/fspath.rb