class Dentaku::AST::StringFunctions::Left

Public Class Methods

max_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 24
def self.max_param_count
  2
end
min_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 20
def self.min_param_count
  2
end
new(*args) click to toggle source
Calls superclass method Dentaku::AST::Function::new
# File lib/dentaku/ast/functions/string_functions.rb, line 28
def initialize(*args)
  super
  @string, @length = *@args
end

Public Instance Methods

value(context = {}) click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 33
def value(context = {})
  string = @string.value(context).to_s
  length = Dentaku::AST::Function.numeric(@length.value(context)).to_i
  negative_argument_failure('LEFT') if length < 0
  string[0, length]
end