Class: ICuke::Simulate::Events::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/icuke/simulate.rb

Direct Known Subclasses

Touch

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = {})
  @options = options
  @hold_for = options[:hold_for] || 0.2
  
  @event_time = self.class.event_time
  
  self.class.hold_for(hold_for)
end

Instance Attribute Details

#event_timeObject (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_forObject (readonly)

Returns the value of attribute hold_for.



7
8
9
# File 'lib/icuke/simulate.rb', line 7

def hold_for
  @hold_for
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/icuke/simulate.rb', line 7

def options
  @options
end

Class Method Details

.event_timeObject



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