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

Inherits:
Function
  • Object
show all
Defined in:
lib/dentaku/ast/functions/string_functions.rb

Instance Method Summary collapse

Methods inherited from Function

#dependencies, get, register, register_class, registry

Methods inherited from Node

arity, #dependencies, precedence

Constructor Details

#initialize(*args) ⇒ Contains

Returns a new instance of Contains.



99
100
101
102
# File 'lib/dentaku/ast/functions/string_functions.rb', line 99

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

Instance Method Details

#value(context = {}) ⇒ Object



104
105
106
# File 'lib/dentaku/ast/functions/string_functions.rb', line 104

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