Class: Space::Events::Sources

Inherits:
Object
  • Object
show all
Defined in:
lib/space/events/sources.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events) ⇒ Sources

Returns a new instance of Sources.



6
7
8
9
# File 'lib/space/events/sources.rb', line 6

def initialize(events)
  @events  = events
  @sources = []
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



4
5
6
# File 'lib/space/events/sources.rb', line 4

def events
  @events
end

#sourcesObject (readonly)

Returns the value of attribute sources.



4
5
6
# File 'lib/space/events/sources.rb', line 4

def sources
  @sources
end

Instance Method Details

#registeredObject



11
12
13
14
15
16
# File 'lib/space/events/sources.rb', line 11

def registered
  register(Thread.current.object_id)
  yield.tap do
    unregister(Thread.current.object_id)
  end
end