Class: Fruity::NamedBlockCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/fruity/named_block_collector.rb

Instance Method Summary collapse

Constructor Details

#initialize(to_hash) ⇒ NamedBlockCollector

Returns a new instance of NamedBlockCollector.



3
4
5
# File 'lib/fruity/named_block_collector.rb', line 3

def initialize(to_hash)
  @to_hash = to_hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



7
8
9
10
# File 'lib/fruity/named_block_collector.rb', line 7

def method_missing(method, *args, &block)
  super unless args.empty?
  @to_hash[method] = block
end