Class: CollectionDelegator

Inherits:
SimpleDelegator show all
Defined in:
lib/r_kit/struct/collection_delegator.rb

Instance Method Summary collapse

Methods inherited from SimpleDelegator

#===, getobj_attr_reader

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/r_kit/struct/collection_delegator.rb', line 6

def method_missing method_name, *args, &block
  closure = super

  case closure
  when collection.class
    self.collection = closure
    self
  else
    closure
  end
end