Module: Space::Events

Included in:
Model::Project, Source
Defined in:
lib/space/events.rb,
lib/space/events/sources.rb,
lib/space/events/subscription.rb

Defined Under Namespace

Classes: Sources, Subscription

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.eventsObject



15
16
17
# File 'lib/space/events.rb', line 15

def events
  @events ||= []
end

.notify(event) ⇒ Object



23
24
25
26
27
28
# File 'lib/space/events.rb', line 23

def notify(event)
  # log event
  subscriptions.each do |subscription|
    subscription.notify(event)
  end
end

.sourcesObject



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

def sources
  @sources ||= Sources.new(self)
end

.subscribe(observer, *types) ⇒ Object



19
20
21
# File 'lib/space/events.rb', line 19

def subscribe(observer, *types)
  subscriptions << Subscription.new(observer, types)
end

.subscriptionsObject



11
12
13
# File 'lib/space/events.rb', line 11

def subscriptions
  @subscriptions ||= []
end

Instance Method Details

#notify(*args) ⇒ Object



31
32
33
# File 'lib/space/events.rb', line 31

def notify(*args)
  Events.notify(*args)
end