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.
72 73 74 75 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 72 def initialize(*args) super @string = @args[0] end |
Instance Method Details
#type ⇒ Object
82 83 84 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 82 def type :numeric end |
#value(context = {}) ⇒ Object
77 78 79 80 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 77 def value(context = {}) string = @string.value(context).to_s string.length end |