Class: Crabfarm::BaseParser

Inherits:
Delegator
  • Object
show all
Defined in:
lib/crabfarm/base_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_driver, _params) ⇒ BaseParser

Returns a new instance of BaseParser.



10
11
12
13
14
15
16
# File 'lib/crabfarm/base_parser.rb', line 10

def initialize(_driver, _params)
  dsl_class = Strategies.load(:browser_dsl, class_browser_dsl || Crabfarm.config.browser_dsl)
  @browser = dsl_class.wrap _driver
  @params = _params

  super @browser
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



4
5
6
# File 'lib/crabfarm/base_parser.rb', line 4

def browser
  @browser
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/crabfarm/base_parser.rb', line 4

def params
  @params
end

Class Method Details

.browser_dsl(_dsl) ⇒ Object



6
7
8
# File 'lib/crabfarm/base_parser.rb', line 6

def self.browser_dsl(_dsl)
  @browser_dsl = _dsl
end

Instance Method Details

#__getobj__Object



22
23
24
# File 'lib/crabfarm/base_parser.rb', line 22

def __getobj__
  @browser
end

#__setobj__(obj) ⇒ Object



26
27
28
# File 'lib/crabfarm/base_parser.rb', line 26

def __setobj__(obj)
  @browser = obj
end

#parseObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/crabfarm/base_parser.rb', line 18

def parse
  raise NotImplementedError.new
end