Class: Aruba::ArubaPath
- Inherits:
-
Object
- Object
- Aruba::ArubaPath
- Defined in:
- lib/aruba/aruba_path.rb
Overview
Pathname for aruba files and directories
Instance Method Summary collapse
-
#[](index) ⇒ Object
Return string at index.
-
#initialize(path) ⇒ ArubaPath
constructor
A new instance of ArubaPath.
-
#pop ⇒ Object
Remove last pushed component of path.
-
#push(p) ⇒ Object
(also: #<<)
Add directory/file to path.
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(path) ⇒ ArubaPath
Returns a new instance of ArubaPath.
9 10 11 |
# File 'lib/aruba/aruba_path.rb', line 9 def initialize(path) @obj = [path.to_s].flatten end |
Instance Method Details
#[](index) ⇒ Object
Return string at index
51 52 53 |
# File 'lib/aruba/aruba_path.rb', line 51 def [](index) to_s[index] end |
#pop ⇒ Object
Remove last pushed component of path
44 45 46 |
# File 'lib/aruba/aruba_path.rb', line 44 def pop @obj.pop end |
#push(p) ⇒ Object Also known as: <<
Add directory/file to path
32 33 34 |
# File 'lib/aruba/aruba_path.rb', line 32 def push(p) @obj << p end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/aruba/aruba_path.rb', line 17 def to_s to_str end |
#to_str ⇒ Object
13 14 15 |
# File 'lib/aruba/aruba_path.rb', line 13 def to_str to_pathname.to_s end |