Class: Crabfarm::CrabtrapContext
- Inherits:
-
Context
- Object
- Context
- Crabfarm::CrabtrapContext
show all
- Defined in:
- lib/crabfarm/crabtrap_context.rb
Instance Attribute Summary collapse
Attributes inherited from Context
#http, #pool, #store
Instance Method Summary
collapse
Methods inherited from Context
#loaded?, #prepare, #release, #reset
Constructor Details
#initialize(_mode = :pass, _path = nil) ⇒ CrabtrapContext
Returns a new instance of CrabtrapContext.
9
10
11
12
|
# File 'lib/crabfarm/crabtrap_context.rb', line 9
def initialize(_mode=:pass, _path=nil)
@mode = _mode
@path = _path
end
|
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
7
8
9
|
# File 'lib/crabfarm/crabtrap_context.rb', line 7
def mode
@mode
end
|
Instance Method Details
#capture(_path) ⇒ Object
22
23
24
25
26
|
# File 'lib/crabfarm/crabtrap_context.rb', line 22
def capture(_path)
@mode = :capture
@path = _path
restart
end
|
#pass_through ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/crabfarm/crabtrap_context.rb', line 14
def pass_through
if not loaded? or @mode != :pass
@mode = :pass
@path = nil
restart
end
end
|
#replay(_path) ⇒ Object
28
29
30
31
32
|
# File 'lib/crabfarm/crabtrap_context.rb', line 28
def replay(_path)
@mode = :replay
@path = _path
restart
end
|
#restart ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/crabfarm/crabtrap_context.rb', line 34
def restart
if not loaded?
prepare
else
stop_daemon
start_daemon
end
end
|