Class: Dentaku::AST::StringFunctions::Len

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

Constant Summary

Constants inherited from Function

Function::DIG

Instance Attribute Summary

Attributes inherited from Function

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#negative_argument_failure

Methods inherited from Function

#accept, #dependencies, get, numeric, register, register_class, registry

Methods inherited from Node

arity, #dependencies, #name, precedence, resolve_class

Constructor Details

#initialize(*args) ⇒ Len

Returns a new instance of Len.



96
97
98
99
# File 'lib/dentaku/ast/functions/string_functions.rb', line 96

def initialize(*args)
  super
  @string = @args[0]
end

Class Method Details

.max_param_countObject



92
93
94
# File 'lib/dentaku/ast/functions/string_functions.rb', line 92

def self.max_param_count
  1
end

.min_param_countObject



88
89
90
# File 'lib/dentaku/ast/functions/string_functions.rb', line 88

def self.min_param_count
  1
end

Instance Method Details

#typeObject



106
107
108
# File 'lib/dentaku/ast/functions/string_functions.rb', line 106

def type
  :numeric
end

#value(context = {}) ⇒ Object



101
102
103
104
# File 'lib/dentaku/ast/functions/string_functions.rb', line 101

def value(context = {})
  string = @string.value(context).to_s
  string.length
end