Class: InternetHakai::TimerAction
- Inherits:
-
RequestAction
- Object
- BaseAction
- RequestAction
- InternetHakai::TimerAction
- Defined in:
- lib/internethakai/action.rb
Constant Summary
Constants inherited from RequestAction
RequestAction::ERROR_MAX, RequestAction::REDIRECT_MAX
Instance Attribute Summary
Attributes inherited from BaseAction
Instance Method Summary collapse
- #fire ⇒ Object
-
#initialize(opt, scenario) ⇒ TimerAction
constructor
A new instance of TimerAction.
- #run ⇒ Object
- #run_super ⇒ Object
Methods inherited from RequestAction
#check_scan, #check_size, #free, #get_client, #get_default, #http_request, #init, #log, #mkclient, #on_complete, #on_error, #on_free, #on_redirect, #on_response, #set_client, #set_wait, #to_s
Methods inherited from BaseAction
#dispatch_next, #free, #get_default, #has_on_complete?, #quit, #set_on_complete
Constructor Details
#initialize(opt, scenario) ⇒ TimerAction
Returns a new instance of TimerAction.
337 338 339 340 341 342 343 |
# File 'lib/internethakai/action.rb', line 337 def initialize opt, scenario super @timer = Rev::TimerWatcher::new(opt['wait'], true) @timer.attach(Rev::Loop::default) @timer.disable @timer.on_timer(&method(:fire)) end |
Instance Method Details
#fire ⇒ Object
344 345 346 347 |
# File 'lib/internethakai/action.rb', line 344 def fire @timer.disable run_super end |
#run ⇒ Object
348 349 350 351 |
# File 'lib/internethakai/action.rb', line 348 def run @timer.reset @timer.enable unless @timer.enabled? end |
#run_super ⇒ Object
336 |
# File 'lib/internethakai/action.rb', line 336 alias :run_super :run |