class Chatbox::Outbox

Attributes

id[R]
store[R]

Public Class Methods

new(entity: req(:entity), store: req(:store)) click to toggle source
# File lib/chatbox/outbox.rb, line 8
def initialize(entity: req(:entity), store: req(:store))
  @id = entity.chatbox_id
  @store = store
end

Public Instance Methods

==(other) click to toggle source
# File lib/chatbox/outbox.rb, line 15
def ==(other)
  other.is_a?(self.class) && id == other.id && store == other.store
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/chatbox/outbox.rb, line 21
def hash
  id.hash ^ store.hash
end

Private Instance Methods

messages() click to toggle source
# File lib/chatbox/outbox.rb, line 31
def messages
  @messages ||= begin
    records = store.find_messages_by_from_id(id)
    records.map { |record| Message.new record: record, store: store }
  end
end