Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/sashimi/core_ext/array.rb
Instance Method Summary collapse
-
#to_absolute_path ⇒ Object
(also: #to_abs_path)
Transform the current
Array
to an absolute path. -
#to_path(absolute = false) ⇒ Object
Transform the current
Array
to a path.
Instance Method Details
#to_absolute_path ⇒ Object Also known as: to_abs_path
Transform the current Array
to an absolute path.
%w(path to app).to_absolute_path # => /Users/luca/path/to/app
%w(path to app).to_abs_path # => /Users/luca/path/to/app
18 19 20 |
# File 'lib/sashimi/core_ext/array.rb', line 18 def to_absolute_path to_path(true) end |
#to_path(absolute = false) ⇒ Object
Transform the current Array
to a path.
It’s an alias for File#join
.
%w(path to app).to_path # => path/to/app+
%w(path to app).to_path(true) # => /Users/luca/path/to/app
8 9 10 11 12 |
# File 'lib/sashimi/core_ext/array.rb', line 8 def to_path(absolute = false) path = File.join(self) path = File.(path) if absolute path end |