Class: Dentaku::AST::StringFunctions::Left

Inherits:
Function show all
Defined in:
lib/dentaku/ast/functions/string_functions.rb

Instance Method Summary collapse

Methods inherited from Function

#dependencies, get, register, register_class

Methods inherited from Node

arity, #dependencies, precedence

Constructor Details

#initialize(string, length) ⇒ Left

Returns a new instance of Left.



7
8
9
10
# File 'lib/dentaku/ast/functions/string_functions.rb', line 7

def initialize(string, length)
  @string = string
  @length = length
end

Instance Method Details

#value(context = {}) ⇒ Object



12
13
14
# File 'lib/dentaku/ast/functions/string_functions.rb', line 12

def value(context={})
  @string.value(context)[0, @length.value(context)]
end