Class: Peruby::Op::Compiled
Overview
Lambda-composed executable with the original tree retained for fallback.
Instance Method Summary collapse
-
#initialize(callable, subroutine = nil) ⇒ Compiled
constructor
A new instance of Compiled.
- #run(env, context) ⇒ Object
- #run_subroutine(env, context) ⇒ Object
Methods inherited from Base
#argument_cells, #local_slot, #lvalue, #to_callable, #warning_directive?
Constructor Details
#initialize(callable, subroutine = nil) ⇒ Compiled
Returns a new instance of Compiled.
37 38 39 40 41 |
# File 'lib/peruby/op.rb', line 37 def initialize(callable, subroutine = nil) super() @callable = callable @subroutine = subroutine || ->(env, context) { catch(:peruby_return) { @callable.call(env, context) } } end |
Instance Method Details
#run(env, context) ⇒ Object
43 |
# File 'lib/peruby/op.rb', line 43 def run(env, context) = @callable.call(env, context) |
#run_subroutine(env, context) ⇒ Object
44 |
# File 'lib/peruby/op.rb', line 44 def run_subroutine(env, context) = @subroutine.call(env, context) |