Module: Lab42::AOP::Tools

Extended by:
Tools
Included in:
Tools
Defined in:
lib/lab42/aop/tools.rb

Instance Method Summary collapse

Instance Method Details

#mk_result_wrapper(bound_mthd, name) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/lab42/aop/tools.rb', line 4

def mk_result_wrapper bound_mthd, name
  result = nil
  wrapper = -> *a, &b do
    wrapper.result = bound_mthd.( *a, &b )
  end
  Meta.add_singleton_method( wrapper, :name ){ name }
  Meta.add_attribute( wrapper, :result )
end