Class: RVM::Functions::Cmp

Inherits:
Function show all
Defined in:
lib/rvm/functions/general/cmp.rb

Overview

The Cmp (compare) function is prett stight fowards, it takes two arguments, not less nor more and compares them using the <=> opperator.

Returned is a Number.

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
# File 'lib/rvm/functions/general/cmp.rb', line 34

def execute params, env
  if params.length == 2
    return RVM::Classes[:number].new(params[0] <=> params[1])
  end
end

.signatureObject



40
41
42
# File 'lib/rvm/functions/general/cmp.rb', line 40

def signature
  [:any] 
end