Class: Dentaku::AST::StringFunctions::Left
- Defined in:
- lib/dentaku/ast/functions/string_functions.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Left
constructor
A new instance of Left.
- #value(context = {}) ⇒ Object
Methods inherited from Function
#dependencies, get, register, register_class, registry
Methods inherited from Node
arity, #dependencies, precedence
Constructor Details
#initialize(*args) ⇒ Left
Returns a new instance of Left.
7 8 9 10 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 7 def initialize(*args) super @string, @length = *@args end |
Instance Method Details
#value(context = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 12 def value(context={}) string = @string.value(context).to_s length = @length.value(context) string[0, length] end |