Method: Dentaku::AST::StringFunctions::Find#value

Defined in:
lib/dentaku/ast/functions/string_functions.rb

#value(context = {}) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/dentaku/ast/functions/string_functions.rb', line 64

def value(context={})
  needle = @needle.value(context)
  needle = needle.to_s unless needle.is_a?(Regexp)
  haystack = @haystack.value(context).to_s
  pos = haystack.index(needle)
  pos && pos + 1
end