Module: Puller
- Defined in:
- lib/puller.rb,
lib/puller/engine.rb,
lib/puller/version.rb,
lib/puller/view_helpers.rb,
lib/generators/puller/install_generator.rb
Defined Under Namespace
Modules: Generators, ViewHelpers
Classes: Engine
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.default_channel ⇒ Object
10
11
12
|
# File 'lib/puller.rb', line 10
def default_channel
@default_channel ||= "default"
end
|
Class Method Details
.channel_and_event_for(text) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/puller.rb', line 23
def channel_and_event_for(text)
channel, event = text.split(':', 1)
if event.nil?
event = channel
channel = default_channel
end
[channel, event]
end
|
.publish_to(channel_event, data) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/puller.rb', line 14
def publish_to(channel_event, data)
channel, event = channel_and_event_for(channel_event)
message = { :channel => channel, :event => event }
message[data.kind_of?(String) ? :eval : :data] = data
Pusher[channel].trigger event, message
end
|