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.



124
125
126
127
# File 'lib/dentaku/ast/functions/string_functions.rb', line 124

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

Instance Method Details

#typeObject



133
134
135
# File 'lib/dentaku/ast/functions/string_functions.rb', line 133

def type
  :logical
end

#value(context = {}) ⇒ Object



129
130
131
# File 'lib/dentaku/ast/functions/string_functions.rb', line 129

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