Class: Dentaku::AST::StringFunctions::Contains

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) ⇒ Contains

Returns a new instance of Contains.



188
189
190
191
# File 'lib/dentaku/ast/functions/string_functions.rb', line 188

def initialize(*args)
  super
  @needle, @haystack = *args
end

Class Method Details

.max_param_countObject



184
185
186
# File 'lib/dentaku/ast/functions/string_functions.rb', line 184

def self.max_param_count
  2
end

.min_param_countObject



180
181
182
# File 'lib/dentaku/ast/functions/string_functions.rb', line 180

def self.min_param_count
  2
end

Instance Method Details

#typeObject



197
198
199
# File 'lib/dentaku/ast/functions/string_functions.rb', line 197

def type
  :logical
end

#value(context = {}) ⇒ Object



193
194
195
# File 'lib/dentaku/ast/functions/string_functions.rb', line 193

def value(context = {})
  @haystack.value(context).to_s.include? @needle.value(context).to_s
end