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
-
.async_handler ⇒ Object
Returns the value of attribute async_handler.
-
.channels ⇒ Object
Returns the value of attribute channels.
Class Method Summary collapse
-
.register(name, channel) ⇒ Object
Internal: Register a new channel.
-
.spread(rumor) ⇒ Object
Internal: Spread a rumor to required channels.
-
.spread_async(rumor) ⇒ Object
Internal: Spread a rumor asynchronously.
Class Attribute Details
.async_handler ⇒ Object
Returns the value of attribute async_handler.
9 10 11 |
# File 'lib/rumor.rb', line 9 def async_handler @async_handler end |
.channels ⇒ Object
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 |