Class: AmberVM::Functions::Center
- Defined in:
- lib/amber/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_type ⇒ Object
18 19 20 |
# File 'lib/amber/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/amber/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 AmberVM::Classes[:error].new(1,"#-1 FUNCTION (#{self.class.to_s}) EXPECTS 2 OR 3 ARGUMENTS BUT GOT #{params.length}") end end |