Class: Packet::Event
- Inherits:
-
Object
- Object
- Packet::Event
- Defined in:
- lib/packet/packet_event.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#cancel_flag ⇒ Object
Returns the value of attribute cancel_flag.
-
#scheduled_time ⇒ Object
Returns the value of attribute scheduled_time.
-
#timer_signature ⇒ Object
Returns the value of attribute timer_signature.
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(elapsed_time, &block) ⇒ Event
constructor
A new instance of Event.
- #run ⇒ Object
- #run_now? ⇒ Boolean
Constructor Details
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/packet/packet_event.rb', line 3 def block @block end |
#cancel_flag ⇒ Object
Returns the value of attribute cancel_flag.
3 4 5 |
# File 'lib/packet/packet_event.rb', line 3 def cancel_flag @cancel_flag end |
#scheduled_time ⇒ Object
Returns the value of attribute scheduled_time.
3 4 5 |
# File 'lib/packet/packet_event.rb', line 3 def scheduled_time @scheduled_time end |
#timer_signature ⇒ Object
Returns the value of attribute timer_signature.
3 4 5 |
# File 'lib/packet/packet_event.rb', line 3 def timer_signature @timer_signature end |
Instance Method Details
#cancel ⇒ Object
16 17 18 |
# File 'lib/packet/packet_event.rb', line 16 def cancel @cancel_flag = true end |
#run ⇒ Object
20 21 22 |
# File 'lib/packet/packet_event.rb', line 20 def run @block.call end |
#run_now? ⇒ Boolean
11 12 13 14 |
# File 'lib/packet/packet_event.rb', line 11 def run_now? return true if @scheduled_time <= Time.now return false end |