Class: Pathname

Inherits:
Object
  • Object
show all
Defined in:
lib/riel/pathname.rb

Instance Method Summary collapse

Instance Method Details

#mkdirsObject



23
24
25
# File 'lib/riel/pathname.rb', line 23

def mkdirs
  File.makedirs to_s
end

#rootnameObject

a compliment to the dirname, basename, and extname family, this returns the basename without the extension, e.g. “foo” from “/usr/share/lib/foo.bar”.



11
12
13
# File 'lib/riel/pathname.rb', line 11

def rootname
  basename.to_s.sub extname.to_s, ''
end

#split_pathObject

Returns an array of the path split into its components. for example: “/usr/bin/ls” => “usr”, “bin”, “ls”



17
18
19
20
21
# File 'lib/riel/pathname.rb', line 17

def split_path
  elements = Array.new
  each_filename { |fn| elements << fn.to_s }
  elements
end