Class: Crabfarm::DriverBucket
- Inherits:
-
Object
- Object
- Crabfarm::DriverBucket
show all
- Defined in:
- lib/crabfarm/driver_bucket.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(_session_id, _factory) ⇒ DriverBucket
6
7
8
9
10
|
# File 'lib/crabfarm/driver_bucket.rb', line 6
def initialize(_session_id, _factory)
@session_id = _session_id
@factory = _factory
@driver = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
44
45
46
|
# File 'lib/crabfarm/driver_bucket.rb', line 44
def method_missing(method, *args, &block)
original.__send__(method, *args, &block)
end
|
Instance Attribute Details
#session_id ⇒ Object
Returns the value of attribute session_id.
4
5
6
|
# File 'lib/crabfarm/driver_bucket.rb', line 4
def session_id
@session_id
end
|
Instance Method Details
#original ⇒ Object
24
25
26
|
# File 'lib/crabfarm/driver_bucket.rb', line 24
def original
@driver ||= @factory.build_driver(@session_id)
end
|
#parse(_parser_class, _options = {}) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/crabfarm/driver_bucket.rb', line 17
def parse(_parser_class, _options={})
_parser_class = LoaderService.load_parser(_parser_class) if _parser_class.is_a? String or _parser_class.is_a? Symbol
parser = _parser_class.new self, _options
parser.parse
return parser
end
|
#reset ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/crabfarm/driver_bucket.rb', line 28
def reset
if @driver
@driver.quit rescue nil
@driver = nil
end
self
end
|
#respond_to?(symbol, include_priv = false) ⇒ Boolean
forward every missing method to actual driver
38
39
40
|
# File 'lib/crabfarm/driver_bucket.rb', line 38
def respond_to?(symbol, include_priv=false)
original.respond_to?(symbol, include_priv)
end
|
#setup(_factory) ⇒ Object
12
13
14
15
|
# File 'lib/crabfarm/driver_bucket.rb', line 12
def setup(_factory)
reset
@factory = _factory
end
|