Class: PresenceChannel::State
- Inherits:
-
Object
- Object
- PresenceChannel::State
- Includes:
- ActiveModel::Serialization
- Defined in:
- lib/presence_channel.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#message_bus_last_id ⇒ Object
readonly
Returns the value of attribute message_bus_last_id.
-
#user_ids ⇒ Object
readonly
Returns the value of attribute user_ids.
Instance Method Summary collapse
-
#initialize(message_bus_last_id:, user_ids: nil, count: nil) ⇒ State
constructor
A new instance of State.
- #users ⇒ Object
Constructor Details
#initialize(message_bus_last_id:, user_ids: nil, count: nil) ⇒ State
Returns a new instance of State.
22 23 24 25 26 27 |
# File 'lib/presence_channel.rb', line 22 def initialize(message_bus_last_id:, user_ids: nil, count: nil) raise "user_ids or count required" if user_ids.nil? && count.nil? @message_bus_last_id = @user_ids = user_ids @count = count || user_ids.count end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
20 21 22 |
# File 'lib/presence_channel.rb', line 20 def count @count end |
#message_bus_last_id ⇒ Object (readonly)
Returns the value of attribute message_bus_last_id.
18 19 20 |
# File 'lib/presence_channel.rb', line 18 def @message_bus_last_id end |
#user_ids ⇒ Object (readonly)
Returns the value of attribute user_ids.
19 20 21 |
# File 'lib/presence_channel.rb', line 19 def user_ids @user_ids end |
Instance Method Details
#users ⇒ Object
29 30 31 32 |
# File 'lib/presence_channel.rb', line 29 def users return nil if user_ids.nil? User.where(id: user_ids) end |