Class: Chatbox::Message

Inherits:
Object
  • Object
show all
Includes:
FakeMissingKeywords
Defined in:
lib/chatbox/message.rb

Instance Method Summary collapse

Methods included from FakeMissingKeywords

#req

Constructor Details

#initialize(record: req(:record), store: req(:store)) ⇒ Message

Returns a new instance of Message.



7
8
9
10
# File 'lib/chatbox/message.rb', line 7

def initialize(record: req(:record), store: req(:store))
  @record = record
  @store = store
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/chatbox/message.rb', line 28

def ==(other)
  other.is_a?(self.class) && record == other.record && store == other.store
end

#mark_as_read!Object



18
19
20
21
# File 'lib/chatbox/message.rb', line 18

def mark_as_read!
  store.mark_message_read! id
  @record = store.find_message id
end

#mark_as_unread!Object



23
24
25
26
# File 'lib/chatbox/message.rb', line 23

def mark_as_unread!
  store.mark_message_unread! id
  @record = store.find_message id
end

#read?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/chatbox/message.rb', line 14

def read?
  record.read
end