Class: RVM::Functions::Append

Inherits:
Function
  • Object
show all
Defined in:
lib/rvm/functions/array/append.rb

Overview

The Append function takes two arguments. The first an List or and anything else as a second parameter.

It will take the List and append the second parameter passed to it to this list in the very end.

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



34
35
36
37
38
39
40
41
42
# File 'lib/rvm/functions/array/append.rb', line 34

def Append.execute params, env
  if params.length == 2
    array = params.shift
    value = params.shift
    array << value
  else
    RVM::Classes[:error].new(1,"#-1 FUNCTION (#{self.class.to_s}) EXPECTS 2 OR MORE ARGUMENTS BUT GOT #{params.length}")
  end
end

.signatureObject



44
45
46
# File 'lib/rvm/functions/array/append.rb', line 44

def Append.signature
  [:list, :any]
end