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 Method Summary collapse

Methods inherited from Base

#negative_argument_failure

Methods inherited from Function

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

Methods inherited from Node

arity, #dependencies, peek, precedence

Constructor Details

#initialize(*args) ⇒ Contains

Returns a new instance of Contains.



140
141
142
143
# File 'lib/dentaku/ast/functions/string_functions.rb', line 140

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

Instance Method Details

#typeObject



149
150
151
# File 'lib/dentaku/ast/functions/string_functions.rb', line 149

def type
  :logical
end

#value(context = {}) ⇒ Object



145
146
147
# File 'lib/dentaku/ast/functions/string_functions.rb', line 145

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