Class: Pathname

Inherits:
Object show all
Defined in:
lib/wukong/extensions/pathname.rb

Direct Known Subclasses

Subdir

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](*vals) ⇒ Object



17
18
19
# File 'lib/wukong/extensions/pathname.rb', line 17

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

Instance Method Details

#/(path) ⇒ Pathname

Append path segments and expand to absolute path

file = Pathname(Dir.pwd) / "subdir1" / :subdir2 / "filename.ext"

Parameters:

  • path (Pathname, String, #to_s)

    path segment to concatenate with receiver

Returns:

  • (Pathname)

    receiver with path appended and expanded to an absolute path



13
14
15
# File 'lib/wukong/extensions/pathname.rb', line 13

def /(path)
  (self + path).expand_path
end