Class: RVM::Functions::And
- Defined in:
- lib/rvm/functions/logic/and.rb
Overview
The And function is a logical function that gets a number of elements as parameters and executes them untill one of them returns false for is_true?, in that case it stops executing and returns a false Boolean. If all elements are is_true? it returns a true Boolean.
Constant Summary collapse
- @@type =
:any
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
.execargs ⇒ Object
52 53 54 |
# File 'lib/rvm/functions/logic/and.rb', line 52 def execargs false end |
.execute(params, env) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rvm/functions/logic/and.rb', line 35 def execute params, env result = RVM::Classes::Boolean.new(true) while result and not params.empty? puts v = params.shift if result.is_true? and v result = v.execute(env) else return RVM::Classes::Boolean.new(false) end end result end |
.signature ⇒ Object
48 49 50 |
# File 'lib/rvm/functions/logic/and.rb', line 48 def signature [:any] # adjust the signature here end |