Class: Chains::WithChain

Inherits:
Object
  • Object
show all
Defined in:
lib/chains/with_chain.rb

Class Method Summary collapse

Class Method Details

.chain_object(object, block) ⇒ Object



9
10
11
12
13
14
# File 'lib/chains/with_chain.rb', line 9

def chain_object(object, block)
  object.send(:define_singleton_method, :chain_with_block, block)
  result = object.chain_with_block
  object.singleton_class.send(:undef_method, :chain_with_block)
  result
end

.with_object(object, block) ⇒ Object



4
5
6
7
# File 'lib/chains/with_chain.rb', line 4

def with_object(object, block)
  chain_object(object, block)
  object
end