Class: ActionCable::SubscriptionAdapter::SubscriberMap::Message
- Inherits:
-
Struct
- Object
- Struct
- ActionCable::SubscriptionAdapter::SubscriberMap::Message
- Defined in:
- lib/action_cable/subscription_adapter/subscriber_map.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #encoded_for(identifier) ⇒ Object
-
#initialize ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
9 10 11 12 |
# File 'lib/action_cable/subscription_adapter/subscriber_map.rb', line 9 def initialize(...) super @cache = Concurrent::Map.new end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
8 9 10 |
# File 'lib/action_cable/subscription_adapter/subscriber_map.rb', line 8 def data @data end |
Instance Method Details
#encoded_for(identifier) ⇒ Object
14 15 16 17 18 |
# File 'lib/action_cable/subscription_adapter/subscriber_map.rb', line 14 def encoded_for(identifier) @cache.compute_if_absent(identifier) do ActiveSupport::JSON.encode({ identifier: identifier, message: ActiveSupport::JSON.decode(data) }) end end |