Class: Configurations::Path
- Inherits:
-
Object
- Object
- Configurations::Path
- Defined in:
- lib/configurations/path.rb
Instance Method Summary collapse
- #add(*path) ⇒ Object
-
#initialize(path = []) ⇒ Path
constructor
A new instance of Path.
- #reduce(initial, &block) ⇒ Object
- #to_s ⇒ Object (also: #inspect, #print)
Constructor Details
#initialize(path = []) ⇒ Path
Returns a new instance of Path.
3 4 5 |
# File 'lib/configurations/path.rb', line 3 def initialize(path = []) @path = path end |
Instance Method Details
#add(*path) ⇒ Object
7 8 9 |
# File 'lib/configurations/path.rb', line 7 def add(*path) Path.new(@path + path) end |
#reduce(initial, &block) ⇒ Object
11 12 13 |
# File 'lib/configurations/path.rb', line 11 def reduce(initial, &block) @path.reduce(initial, &block) end |
#to_s ⇒ Object Also known as: inspect, print
15 16 17 |
# File 'lib/configurations/path.rb', line 15 def to_s @path.join(".") end |