Class: ICuke::Simulate::Events::Event
- Inherits:
-
Object
- Object
- ICuke::Simulate::Events::Event
- Defined in:
- lib/icuke/simulate.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#event_time ⇒ Object
readonly
Returns the value of attribute event_time.
-
#hold_for ⇒ Object
readonly
Returns the value of attribute hold_for.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(options = {}) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 15 16 |
# File 'lib/icuke/simulate.rb', line 9 def initialize( = {}) @options = @hold_for = [:hold_for] || 0.2 @event_time = self.class.event_time self.class.hold_for(hold_for) end |
Instance Attribute Details
#event_time ⇒ Object (readonly)
Returns the value of attribute event_time.
7 8 9 |
# File 'lib/icuke/simulate.rb', line 7 def event_time @event_time end |
#hold_for ⇒ Object (readonly)
Returns the value of attribute hold_for.
7 8 9 |
# File 'lib/icuke/simulate.rb', line 7 def hold_for @hold_for end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/icuke/simulate.rb', line 7 def @options end |
Class Method Details
.event_time ⇒ Object
18 19 20 |
# File 'lib/icuke/simulate.rb', line 18 def self.event_time @time.to_i end |
.hold_for(seconds) ⇒ Object
22 23 24 |
# File 'lib/icuke/simulate.rb', line 22 def self.hold_for(seconds) @time = @time.to_i + (seconds * 1_000_000_000) end |