Class: RVM::Functions::Split

Inherits:
Function show all
Defined in:
lib/rvm/functions/list/split.rb

Overview

The split function is used to split a string by a sepperator char and generate a list from the passed elements.

It takes two arguments, the first to be the string to split and the second the sepperator to split by. Note: the sepperator will be removed from the result.

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



48
49
50
# File 'lib/rvm/functions/list/split.rb', line 48

def data_type
  :list
end

.execute(params, env) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/rvm/functions/list/split.rb', line 36

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

.signatureObject



44
45
46
# File 'lib/rvm/functions/list/split.rb', line 44

def signature
  [:string, :string]
end