class Dentaku::AST::StringFunctions::Find

Public Class Methods

max_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 116
def self.max_param_count
  2
end
min_param_count() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 112
def self.min_param_count
  2
end
new(*args) click to toggle source
Calls superclass method Dentaku::AST::Function::new
# File lib/dentaku/ast/functions/string_functions.rb, line 120
def initialize(*args)
  super
  @needle, @haystack = *@args
end

Public Instance Methods

type() click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 133
def type
  :numeric
end
value(context = {}) click to toggle source
# File lib/dentaku/ast/functions/string_functions.rb, line 125
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