Class: RGL::PathBuilder
- Inherits:
-
Object
- Object
- RGL::PathBuilder
- Defined in:
- lib/rgl/path_builder.rb
Instance Method Summary collapse
-
#initialize(source, parents_map) ⇒ PathBuilder
constructor
A new instance of PathBuilder.
- #path(target) ⇒ Object
- #paths(targets) ⇒ Hash
Constructor Details
#initialize(source, parents_map) ⇒ PathBuilder
Returns a new instance of PathBuilder.
7 8 9 10 11 |
# File 'lib/rgl/path_builder.rb', line 7 def initialize(source, parents_map) @source = source @parents_map = parents_map @paths = {} end |
Instance Method Details
#path(target) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rgl/path_builder.rb', line 13 def path(target) if @paths.key?(target) @paths[target] else @paths[target] = restore_path(target) end end |
#paths(targets) ⇒ Hash
22 23 24 25 26 27 28 29 30 |
# File 'lib/rgl/path_builder.rb', line 22 def paths(targets) paths_map = {} targets.each do |target| paths_map[target] = path(target) end paths_map end |