Class: Hyalite::SyntheticEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/hyalite/synthetic_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ SyntheticEvent

Returns a new instance of SyntheticEvent.



5
6
7
8
# File 'lib/hyalite/synthetic_event.rb', line 5

def initialize(event)
  @event = event
  @listeners = []
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'lib/hyalite/synthetic_event.rb', line 3

def event
  @event
end

Instance Method Details

#add_listener(listener, target_id) ⇒ Object



10
11
12
# File 'lib/hyalite/synthetic_event.rb', line 10

def add_listener(listener, target_id)
  @listeners << [listener, target_id]
end

#each_listener(&block) ⇒ Object



14
15
16
# File 'lib/hyalite/synthetic_event.rb', line 14

def each_listener(&block)
  @listeners.each {|listener| yield(listener) }
end