Class: RVM::Functions::Center

Inherits:
Function
  • Object
show all
Defined in:
lib/rvm/functions/string/center.rb

Class Method Summary collapse

Methods inherited from Function

call, execargs, method_missing

Methods included from Plugin

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

Class Method Details

.data_typeObject



18
19
20
# File 'lib/rvm/functions/string/center.rb', line 18

def data_type
  :string
end

.execute(params, env) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/rvm/functions/string/center.rb', line 5

def execute params, env
  if params.length == 2
    params[0].center(params[1])
  elsif params.length == 3
    params[0].center(params[1], params[2])
  else
    RVM::Classes[:error].new(1,"#-1 FUNCTION (#{self.class.to_s}) EXPECTS 2 OR 3 ARGUMENTS BUT GOT #{params.length}")
  end
end

.signatureObject



15
16
17
# File 'lib/rvm/functions/string/center.rb', line 15

def signature
  [:string, :number, :string]
end