Module: GetSchwifty::Channel
- Included in:
- GetSchwiftyChannel
- Defined in:
- lib/get_schwifty/channel.rb
Overview
:nodoc
Instance Method Summary collapse
- #action ⇒ Object
- #channel_name ⇒ Object
- #controller ⇒ Object
- #identifiers ⇒ Object
- #rendered ⇒ Object
- #route ⇒ Object
- #schwifty_job_id ⇒ Object
- #subscribed ⇒ Object
Instance Method Details
#action ⇒ Object
25 26 27 |
# File 'lib/get_schwifty/channel.rb', line 25 def action route.split("#").last end |
#channel_name ⇒ Object
39 40 41 |
# File 'lib/get_schwifty/channel.rb', line 39 def channel_name "get_schwifty:#{schwifty_job_id}" end |
#controller ⇒ Object
21 22 23 |
# File 'lib/get_schwifty/channel.rb', line 21 def controller (route.split("#").first + "_cable").camelize end |
#identifiers ⇒ Object
29 30 31 32 33 |
# File 'lib/get_schwifty/channel.rb', line 29 def identifiers connection.identifiers.collect do |key| [key.to_s, send(key)] end end |
#rendered ⇒ Object
13 14 15 |
# File 'lib/get_schwifty/channel.rb', line 13 def rendered Rails.cache.write(channel_name, nil) unless GetSchwifty.allow_rerender end |
#route ⇒ Object
17 18 19 |
# File 'lib/get_schwifty/channel.rb', line 17 def route Rails.cache.read(channel_name) end |
#schwifty_job_id ⇒ Object
35 36 37 |
# File 'lib/get_schwifty/channel.rb', line 35 def schwifty_job_id params[:id] end |
#subscribed ⇒ Object
6 7 8 9 10 11 |
# File 'lib/get_schwifty/channel.rb', line 6 def subscribed reject if route.blank? stream_from channel_name GetSchwiftyRunnerJob.perform_later(channel_name, controller, action, params, *identifiers.flatten) end |