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.
11 12 13 |
# File 'lib/aruba/aruba_path.rb', line 11 def initialize(path) @obj = [path.to_s].flatten end |
Instance Method Details
#[](index) ⇒ Object
Return string at index
53 54 55 |
# File 'lib/aruba/aruba_path.rb', line 53 def [](index) to_s[index] end |
#pop ⇒ Object
Remove last pushed component of path
46 47 48 |
# File 'lib/aruba/aruba_path.rb', line 46 def pop @obj.pop end |
#push(p) ⇒ Object Also known as: <<
Add directory/file to path
34 35 36 |
# File 'lib/aruba/aruba_path.rb', line 34 def push(p) @obj << p end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/aruba/aruba_path.rb', line 19 def to_s to_str end |
#to_str ⇒ Object
15 16 17 |
# File 'lib/aruba/aruba_path.rb', line 15 def to_str to_pathname.to_s end |