Module: Outlander::Crawler::ClassMethods

Defined in:
lib/outlander/crawler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/outlander/crawler.rb', line 38

def method_missing(m, *args, &block)
  if m.to_s.start_with? 'process_'
    @handlers[m] = block
  else
    super
  end
end

Instance Attribute Details

#handlersObject (readonly)

Returns the value of attribute handlers.



28
29
30
# File 'lib/outlander/crawler.rb', line 28

def handlers
  @handlers
end

#rootsObject (readonly)

Returns the value of attribute roots.



28
29
30
# File 'lib/outlander/crawler.rb', line 28

def roots
  @roots
end

#setupObject (readonly)

Returns the value of attribute setup.



28
29
30
# File 'lib/outlander/crawler.rb', line 28

def setup
  @setup
end

Instance Method Details

#before_start(&block) ⇒ Object



34
35
36
# File 'lib/outlander/crawler.rb', line 34

def before_start(&block)
  @setup = block
end

#entry_point(url, handler = :process_root) ⇒ Object



30
31
32
# File 'lib/outlander/crawler.rb', line 30

def entry_point(url, handler = :process_root)
  @roots[url] = handler
end