Class: RGL::PathBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/rgl/path_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(source, parents_map) ⇒ PathBuilder

Returns a new instance of PathBuilder.



5
6
7
8
9
# File 'lib/rgl/path_builder.rb', line 5

def initialize(source, parents_map)
  @source      = source
  @parents_map = parents_map
  @paths       = {}
end

Instance Method Details

#path(target) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rgl/path_builder.rb', line 11

def path(target)
  if @paths.has_key?(target)
    @paths[target]
  else
    @paths[target] = restore_path(target)
  end
end

#paths(targets) ⇒ Hash

Returns:

  • (Hash)


20
21
22
23
24
25
26
27
28
# File 'lib/rgl/path_builder.rb', line 20

def paths(targets)
  paths_map = {}

  targets.each do |target|
    paths_map[target] = path(target)
  end

  paths_map
end