Class: Abstractivator::Trees::BlockCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/abstractivator/trees/block_collector.rb

Instance Method Summary collapse

Constructor Details

#initializeBlockCollector

Returns a new instance of BlockCollector.



5
6
7
# File 'lib/abstractivator/trees/block_collector.rb', line 5

def initialize
  @config = {}
end

Instance Method Details

#get_path_treeObject



13
14
15
16
17
18
19
# File 'lib/abstractivator/trees/block_collector.rb', line 13

def get_path_tree
  path_tree = {}
  @config.each_pair do |path, block|
    set_hash_path(path_tree, path.split('/'), block)
  end
  path_tree
end

#when(path, &block) ⇒ Object



9
10
11
# File 'lib/abstractivator/trees/block_collector.rb', line 9

def when(path, &block)
  @config[path] = block
end