Module: Scruber::Core::Extensions::ParserAliases::CoreMethods

Defined in:
lib/scruber/core/extensions/parser_aliases.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/scruber/core/extensions/parser_aliases.rb', line 35

def self.included(base)
  Scruber::Core::Crawler.register_method_missing /\Aparse_(\w+)\Z/ do |meth, scan_results, args|
    page_type = scan_results.first.first
    page_format = args.first.is_a?(Symbol) ? args.shift : nil
    block = args.shift
    parser(page_type, {format: page_format}, &block)
  end
end

Instance Method Details

#parse(*args, &block) ⇒ Object



30
31
32
33
# File 'lib/scruber/core/extensions/parser_aliases.rb', line 30

def parse(*args, &block)
  page_format = args.shift
  parser('seed', {format: page_format}, &block)
end