Method: Scruber::Core::Crawler#method_missing

Defined in:
lib/scruber/core/crawler.rb

#method_missing(method_sym, *arguments, &block) ⇒ type

Method missing callback. Scruber allows to register regexp and proc body to process calls

Parameters:

  • method_sym (Symbol)

    missing method name

  • arguments (Array)

    arguments

  • block (Proc)

    block (if passed)

Returns:

  • (type)
    description


106
107
108
109
110
111
112
113
# File 'lib/scruber/core/crawler.rb', line 106

def method_missing(method_sym, *arguments, &block)
  Scruber::Core::Crawler._registered_method_missings.each do |(pattern, func)|
    if (scan_results = method_sym.to_s.scan(pattern)).present?
      return instance_exec(method_sym, scan_results, arguments+[block], &(func))
    end
  end
  super
end