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

+ (Object) events



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

def events
  @events ||= []
end

+ (Object) notify(event)



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

+ (Object) sources



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

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

+ (Object) subscribe(observer, *types)



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

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

+ (Object) subscriptions



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

def subscriptions
  @subscriptions ||= []
end

Instance Method Details

- (Object) notify(*args)



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

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