Class: RVM::Functions::Or

Inherits:
Function show all
Defined in:
lib/rvm/functions/logic/or.rb

Overview

The Or function is a logical function that gets a number of elements as parameters and executes them untill one of them is_true?, in that case it stops executing and returns a true Boolean. If it does not find any element that is_true? it returns a false Boolean.

Class Method Summary collapse

Methods inherited from Function

call, data_type, method_missing

Methods included from Plugin

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

Class Method Details

.execargsObject



47
48
49
# File 'lib/rvm/functions/logic/or.rb', line 47

def execargs
  false
end

.execute(params, env) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/rvm/functions/logic/or.rb', line 35

def execute params, env
  params.each do |p|
    v =  p.execute(env)
    return v if p && v.is_true?
  end
  return RVM::Classes::Boolean.new(false)
end

.signatureObject



43
44
45
# File 'lib/rvm/functions/logic/or.rb', line 43

def signature
  [:any] # adjust the signature here
end