Class: ProconBypassMan::Scheduler::Schedule
- Inherits:
-
Object
- Object
- ProconBypassMan::Scheduler::Schedule
- Defined in:
- lib/procon_bypass_man/scheduler.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#next_enqueue_at ⇒ Object
Returns the value of attribute next_enqueue_at.
Instance Method Summary collapse
- #enqueue ⇒ void
-
#initialize(klass:, args:, interval:) ⇒ Schedule
constructor
A new instance of Schedule.
- #past_interval? ⇒ boolean
Constructor Details
#initialize(klass:, args:, interval:) ⇒ Schedule
Returns a new instance of Schedule.
9 10 11 12 13 14 |
# File 'lib/procon_bypass_man/scheduler.rb', line 9 def initialize(klass: , args: , interval: ) self.klass = klass self.args = args self.interval = interval self.next_enqueue_at = Time.now end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
4 5 6 |
# File 'lib/procon_bypass_man/scheduler.rb', line 4 def args @args end |
#interval ⇒ Object
Returns the value of attribute interval.
4 5 6 |
# File 'lib/procon_bypass_man/scheduler.rb', line 4 def interval @interval end |
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/procon_bypass_man/scheduler.rb', line 4 def klass @klass end |
#next_enqueue_at ⇒ Object
Returns the value of attribute next_enqueue_at.
4 5 6 |
# File 'lib/procon_bypass_man/scheduler.rb', line 4 def next_enqueue_at @next_enqueue_at end |
Instance Method Details
#enqueue ⇒ void
This method returns an undefined value.
17 18 19 20 |
# File 'lib/procon_bypass_man/scheduler.rb', line 17 def enqueue klass.perform_async(*unwrap_args(args)) set_next_enqueue_at! end |
#past_interval? ⇒ boolean
23 24 25 |
# File 'lib/procon_bypass_man/scheduler.rb', line 23 def past_interval? next_enqueue_at < Time.now end |