Class: EleetScript::ESProc

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/esproc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(proc, engine) ⇒ ESProc

Returns a new instance of ESProc.



5
6
7
8
# File 'lib/engine/esproc.rb', line 5

def initialize(proc, engine)
  @proc = proc
  @engine = engine
end

Instance Attribute Details

#procObject

Returns the value of attribute proc.



3
4
5
# File 'lib/engine/esproc.rb', line 3

def proc
  @proc
end

Instance Method Details

#call(receiver, args, context) ⇒ Object



10
11
12
13
14
15
# File 'lib/engine/esproc.rb', line 10

def call(receiver, args, context)
  ruby_args = args.map do |arg|
    Values.to_ruby_value(arg, @engine)
  end
  Values.to_eleet_value(proc.call(*ruby_args), @engine)
end