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

Inherits:
Function
  • Object
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 Function

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

Methods inherited from Node

arity, #dependencies, peek, precedence

Constructor Details

#initialize(*args) ⇒ 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