Module: RenderTurboStream::ChannelViewHelpers
- Defined in:
- lib/render_turbo_stream/channel_view_helpers.rb
Instance Method Summary collapse
- #channel_from_all ⇒ Object
- #channel_from_authenticated_group(group) ⇒ Object
- #channel_from_group(group) ⇒ Object
- #channel_from_me ⇒ Object
- #fetch_instance_variables(locals) ⇒ Object
Instance Method Details
#channel_from_all ⇒ Object
22 23 24 |
# File 'lib/render_turbo_stream/channel_view_helpers.rb', line 22 def channel_from_all turbo_stream_from "all" end |
#channel_from_authenticated_group(group) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/render_turbo_stream/channel_view_helpers.rb', line 13 def channel_from_authenticated_group(group) if current_user turbo_stream_from "authenticated_group_#{group}" else Rails.logger.debug(" • SKIP channel_from_authenticated_group because not authenticated") nil end end |
#channel_from_group(group) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/render_turbo_stream/channel_view_helpers.rb', line 26 def channel_from_group(group) if group.present? turbo_stream_from group else Rails.logger.debug(" • SKIP channel_from_group because no group given") nil end end |
#channel_from_me ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/render_turbo_stream/channel_view_helpers.rb', line 4 def channel_from_me if current_user turbo_stream_from "authenticated_user_#{current_user.id}" else Rails.logger.debug(" • SKIP channel_from_me because not authenticated") nil end end |
#fetch_instance_variables(locals) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/render_turbo_stream/channel_view_helpers.rb', line 35 def fetch_instance_variables(locals) locals.each do |k,v| if k[0..38] == 'render_turbo_stream_instance_variable_@' eval "#{k[38..-1]} = v" end end end |