Class: Abstractivator::Trees::BlockCollector
- Defined in:
- lib/abstractivator/trees/block_collector.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #get_path_tree ⇒ Object
-
#initialize ⇒ BlockCollector
constructor
A new instance of BlockCollector.
- #when(path, &block) ⇒ Object
Constructor Details
#initialize ⇒ BlockCollector
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
#delete ⇒ Object
21 22 23 |
# File 'lib/abstractivator/trees/block_collector.rb', line 21 def delete @delete ||= Object.new end |
#get_path_tree ⇒ Object
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 |