Class: Controll::Events

Inherits:
Object
  • Object
show all
Includes:
Controll::Event::Helper, Enumerable
Defined in:
lib/controll/events.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Controll::Event::Helper

#create_event, #normalize

Constructor Details

#initialize(*events) ⇒ Events

Returns a new instance of Events.



8
9
10
# File 'lib/controll/events.rb', line 8

def initialize *events
  @events = events.flatten.map{|event| normalize event }
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



6
7
8
# File 'lib/controll/events.rb', line 6

def events
  @events
end

Class Method Details

.valid_typesObject



24
25
26
# File 'lib/controll/events.rb', line 24

def self.valid_types
  Controll::Event.valid_types
end

Instance Method Details

#<<(event) ⇒ Object



16
17
18
# File 'lib/controll/events.rb', line 16

def << event
  events << event
end

#eachObject



12
13
14
# File 'lib/controll/events.rb', line 12

def each
  events.each {|event| yield event }
end

#lastObject



20
21
22
# File 'lib/controll/events.rb', line 20

def last
  events.last
end

#valid_typesObject



44
45
46
# File 'lib/controll/events.rb', line 44

def valid_types
  Controll::Event.valid_types
end