Class: Dentaku::AST::StringFunctions::Len
- Defined in:
- lib/dentaku/ast/functions/string_functions.rb
Constant Summary
Constants inherited from Function
Instance Method Summary collapse
-
#initialize(*args) ⇒ Len
constructor
A new instance of Len.
- #type ⇒ Object
- #value(context = {}) ⇒ Object
Methods inherited from Base
Methods inherited from Function
#dependencies, get, numeric, register, register_class, registry
Methods inherited from Node
arity, #dependencies, peek, precedence
Constructor Details
#initialize(*args) ⇒ Len
Returns a new instance of Len.
64 65 66 67 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 64 def initialize(*args) super @string = @args[0] end |
Instance Method Details
#type ⇒ Object
74 75 76 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 74 def type :numeric end |
#value(context = {}) ⇒ Object
69 70 71 72 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 69 def value(context = {}) string = @string.value(context).to_s string.length end |