Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/riel/pathname.rb
Instance Method Summary collapse
- #mkdirs ⇒ Object
-
#rootname ⇒ Object
a compliment to the
dirname,basename, andextnamefamily, this returns the basename without the extension, e.g. -
#split_path ⇒ Object
Returns an array of the path split into its components.
Instance Method Details
#mkdirs ⇒ Object
23 24 25 |
# File 'lib/riel/pathname.rb', line 23 def mkdirs File.makedirs to_s end |
#rootname ⇒ Object
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_path ⇒ Object
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 |