Class: InternetHakai::TimerAction

Inherits:
RequestAction show all
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

#performance_id

Instance Method Summary collapse

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

#fireObject



344
345
346
347
# File 'lib/internethakai/action.rb', line 344

def fire
    @timer.disable
    run_super
end

#runObject



348
349
350
351
# File 'lib/internethakai/action.rb', line 348

def run
    @timer.reset
    @timer.enable unless @timer.enabled?
end

#run_superObject



336
# File 'lib/internethakai/action.rb', line 336

alias :run_super :run