Sha256: ae17fd3517fc5fb7550c17826af3dad80194ffd093da39cff4c1ee222488213e

Contents?: true

Size: 597 Bytes

Versions: 22

Compression:

Stored size: 597 Bytes

Contents

require 'pathname'
class Pathname
  # Append path segments and expand to absolute path
  #
  #   file = Pathname(Dir.pwd) / "subdir1" / :subdir2 / "filename.ext"
  #
  # @param [Pathname, String, #to_s] path path segment to concatenate with receiver
  #
  # @return [Pathname]
  #   receiver with _path_ appended and expanded to an absolute path
  #
  # @api public
  def /(path)
    (self + path).expand_path
  end

  def self.[](*vals)
    new( File.join(vals) )
  end
end

class Subdir < Pathname
  def self.[](*vals)
    dir = File.dirname(vals.shift)
    new(File.join(dir, *vals))
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
mrflip-wukong-0.1.0 lib/wukong/extensions/pathname.rb
wukong-3.0.0.pre old/wukong/extensions/pathname.rb
wukong-2.0.2 lib/wukong/extensions/pathname.rb
wukong-2.0.1 lib/wukong/extensions/pathname.rb
wukong-2.0.0 lib/wukong/extensions/pathname.rb
wukong-1.5.4 lib/wukong/extensions/pathname.rb
wukong-1.5.3 lib/wukong/extensions/pathname.rb
wukong-1.5.2 lib/wukong/extensions/pathname.rb
wukong-1.5.1 lib/wukong/extensions/pathname.rb
wukong-1.5.0 lib/wukong/extensions/pathname.rb
wukong-1.4.12 lib/wukong/extensions/pathname.rb
wukong-1.4.11 lib/wukong/extensions/pathname.rb
wukong-1.4.10 lib/wukong/extensions/pathname.rb
wukong-1.4.9 lib/wukong/extensions/pathname.rb
wukong-1.4.7 lib/wukong/extensions/pathname.rb
wukong-1.4.6 lib/wukong/extensions/pathname.rb
wukong-1.4.5 lib/wukong/extensions/pathname.rb
wukong-1.4.2 lib/wukong/extensions/pathname.rb
wukong-1.4.1 lib/wukong/extensions/pathname.rb
wukong-1.4.0 lib/wukong/extensions/pathname.rb