Class: AmberVM::Functions::Power

Inherits:
Function show all
Defined in:
lib/amber/functions/math/power.rb

Class Method Summary collapse

Methods inherited from Function

call, data_type, execargs, method_missing

Methods included from Plugin

#helper, #included, #plugin_host, #plugin_id, #register_for

Class Method Details

.execute(params, env) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/amber/functions/math/power.rb', line 29

def Power.execute params, env
  if params.length == 2
    AmberVM::Classes::Number.new(params[0] ** params[1])
  else
    AmberVM::Classes[:error].new(1,"FUNCTION (#{self.name}) EXPECTS 2 ARGUMENTS BUT GOT #{params.length}")
  end
end

.signatureObject



37
38
39
# File 'lib/amber/functions/math/power.rb', line 37

def Power.signature
  [AmberVM::Classes::Number, AmberVM::Classes::Number]
end