Class: RVM::Functions::Function

Inherits:
Object
  • Object
show all
Extended by:
Plugin
Defined in:
lib/rvm/functions.rb

Class Method Summary collapse

Methods included from Plugin

helper, included, plugin_host, plugin_id, register_for

Class Method Details

.call(params, env, pos = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rvm/functions.rb', line 32

def call params, env, pos = nil
  i = 0
  sig = :any 
  params.map! do |p| 
    sig = signature[i] || sig
    if sig != :any and p.class != RVM::Classes[sig]
      raise "TYPE MISMATCH! expected #{sig} got #{p.class}(#{pos}) at " if RVM::strict
      p = RVM::Classes[sig].new(p)
    end
    i+=1
    p 
  end if not signature.empty?
  r = execute(params, env)
  RVM::debug "#{self.inspect}: #{signature.inspect} = '#{r}'" if $DEBUG
  r
end

.data_typeObject



12
13
14
# File 'lib/rvm/functions.rb', line 12

def data_type
  :any
end

.execargsObject

This is for letting he itnerpreter know that it shall interprete the arguments and not let the function do it itself (this is needed for logical functions)



28
29
30
# File 'lib/rvm/functions.rb', line 28

def execargs
  true
end

.execute(params, env) ⇒ Object



49
50
51
# File 'lib/rvm/functions.rb', line 49

def execute params, env
  
end

.method_missing(m, *args, &block) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/rvm/functions.rb', line 18

def method_missing(m, *args, &block)
  if (RVM::Functions::has? m)
    RVM::Functions[m].execute args, @env 
  else
    method_missing_old_functions m, *args, &block
  end
end

.method_missing_old_functionsObject



16
# File 'lib/rvm/functions.rb', line 16

alias :method_missing_old_functions :method_missing