class Block
Public Class Methods
new(body)
click to toggle source
# File lib/sdx/vm/datatypes.rb, line 642 def initialize(body) @internal = body @fields = { "__call" => (NativeFnInternal.new (Proc.new do |args, scope| call args, scope end)), "__arity" => (Int.new 1), "__eq" => (NativeFnInternal.new (lambda do |other| Bool.new @internal == other[0].internal end)), "__neq" => (NativeFnInternal.new (lambda do |other| Bool.new @internal != other[0].internal end)) } end
Public Instance Methods
call(passed, scope)
click to toggle source
# File lib/sdx/vm/datatypes.rb, line 659 def call(passed, scope) passed.reverse! vm = VM.new StringIO.new @internal scope.variables.each do |k| vm.global.add_var k[0], (scope.get_var k[0]) end vm.global.add_var "_", passed[0] vm.interpret vm.stack[-1] end