Class: Stimul8::ComponentChannel
- Inherits:
-
ApplicationCable::Channel
- Object
- ActionCable::Channel::Base
- ApplicationCable::Channel
- Stimul8::ComponentChannel
- Defined in:
- app/channels/stimul8/component_channel.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
Instance Method Summary collapse
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
3 4 5 |
# File 'app/channels/stimul8/component_channel.rb', line 3 def component @component end |
Instance Method Details
#action(data = {}) ⇒ Object
13 14 15 16 |
# File 'app/channels/stimul8/component_channel.rb', line 13 def action data = {} action = data.delete("action") @component.send(action.to_sym, **data.symbolize_keys) end |
#subscribed ⇒ Object
5 6 7 |
# File 'app/channels/stimul8/component_channel.rb', line 5 def subscribed @component = Stimul8::Component.recreate params[:component_class], params[:component_id], context: context end |
#unsubscribed ⇒ Object
9 10 11 |
# File 'app/channels/stimul8/component_channel.rb', line 9 def unsubscribed @component = nil end |