class Dentaku::AST::StringFunctions::Right

Public Class Methods

max_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 46
def self.max_param_count
  2
end
min_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 42
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 50
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 55
def value(context = {})
  string = @string.value(context).to_s
  length = Dentaku::AST::Function.numeric(@length.value(context)).to_i
  negative_argument_failure('RIGHT') if length < 0
  string[length * -1, length] || string
end