Class: RVM::Functions::AssocGet

Inherits:
Function
  • Object
show all
Defined in:
lib/rvm/functions/association/assoc_get.rb

Class Method Summary collapse

Methods inherited from Function

call, data_type, execargs, method_missing, method_missing_old_functions

Methods included from Plugin

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

Class Method Details

.execute(params, env) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rvm/functions/association/assoc_get.rb', line 5

def execute params, env
  if params.length == 2
    assoc = params.shift
    key = params.shift
    assoc[key]
  elsif params.length == 1 and (this = env.read_var_val(:self)).is_a?(RVM::Classes[:association]) 
    this[params.shift]
  else
    RVM::Classes[:error].new(1,"FUNCTION (#{self.class}) EXPECTS 2 or 1 ARGUMENTS BUT GOT #{params.length}")
  end
end

.signatureObject



17
18
19
# File 'lib/rvm/functions/association/assoc_get.rb', line 17

def signature
  [:any]
end