Class: Perl::Stack::Function
Instance Method Summary collapse
-
#initialize(stack, args, &block) ⇒ Function
constructor
A new instance of Function.
- #pop_scalar ⇒ Object
- #push(value) ⇒ Object
Constructor Details
#initialize(stack, args, &block) ⇒ Function
Returns a new instance of Function.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/perl/stack/function.rb', line 2 def initialize(stack, args, &block) @stack = stack @stack.dSP @stack.enter @stack.savetmps case args when nil # nothing when Hash init_with_hash(args) else init_with_array(Array(args)) end yield(self) ensure if @stack @stack.freetmps @stack.leave end end |
Instance Method Details
#pop_scalar ⇒ Object
30 31 32 33 34 35 |
# File 'lib/perl/stack/function.rb', line 30 def pop_scalar @stack.spagain return @stack.pops ensure @stack.putback end |