Class: Accidently::MethodInvoker
- Defined in:
- lib/accidently/method_invoker.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(v) ⇒ MethodInvoker
constructor
A new instance of MethodInvoker.
- #invoke(meth, args, &blk) ⇒ Object
Constructor Details
#initialize(v) ⇒ MethodInvoker
Returns a new instance of MethodInvoker.
12 13 14 |
# File 'lib/accidently/method_invoker.rb', line 12 def initialize v @v = v end |
Class Method Details
.invoke(v, meth, args, &blk) ⇒ Object
8 9 10 |
# File 'lib/accidently/method_invoker.rb', line 8 def self.invoke v, meth, args, &blk self.new(v).invoke(meth, args, &blk) end |
Instance Method Details
#invoke(meth, args, &blk) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/accidently/method_invoker.rb', line 16 def invoke meth, args, &blk v, warns = yield_and_collect_stderr { invocation_result, fail = either { do_send(meth, args, &blk) } if should_do_block_execute(invocation_result, fail) then either { invoke_and_infer_block(meth, args) }.compact.first else invocation_result end } # TODO handle the warns v end |