Module: Rumor

Defined in:
lib/rumor.rb,
lib/rumor/rumor.rb,
lib/rumor/source.rb,
lib/rumor/channel.rb,
lib/rumor/version.rb,
lib/rumor/async/resque.rb

Defined Under Namespace

Modules: Async, Source Classes: Channel, Rumor

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.async_handlerObject

Returns the value of attribute async_handler.



9
10
11
# File 'lib/rumor.rb', line 9

def async_handler
  @async_handler
end

.channelsObject

Returns the value of attribute channels.



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

def channels
  @channels
end

Class Method Details

.register(name, channel) ⇒ Object

Internal: Register a new channel.



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

def self.register name, channel
  self.channels[name] = channel
end

.spread(rumor) ⇒ Object

Internal: Spread a rumor to required channels.



20
21
22
23
24
# File 'lib/rumor.rb', line 20

def self.spread rumor
  self.channels.each do |name, channel|
    channel.send rumor if rumor.to?(name)
  end
end

.spread_async(rumor) ⇒ Object

Internal: Spread a rumor asynchronously.



27
28
29
# File 'lib/rumor.rb', line 27

def self.spread_async rumor
  self.async_handler.spread_async rumor
end