Module: Noticed::Readable

Extended by:
ActiveSupport::Concern
Included in:
Notification
Defined in:
app/models/concerns/noticed/readable.rb

Instance Method Summary collapse

Instance Method Details

#mark_as_readObject



30
31
32
# File 'app/models/concerns/noticed/readable.rb', line 30

def mark_as_read
  update(read_at: Time.current)
end

#mark_as_read!Object



34
35
36
# File 'app/models/concerns/noticed/readable.rb', line 34

def mark_as_read!
  update!(read_at: Time.current)
end

#mark_as_seenObject



46
47
48
# File 'app/models/concerns/noticed/readable.rb', line 46

def mark_as_seen
  update(seen_at: Time.current)
end

#mark_as_seen!Object



50
51
52
# File 'app/models/concerns/noticed/readable.rb', line 50

def mark_as_seen!
  update!(seen_at: Time.current)
end

#mark_as_unreadObject



38
39
40
# File 'app/models/concerns/noticed/readable.rb', line 38

def mark_as_unread
  update(read_at: nil)
end

#mark_as_unread!Object



42
43
44
# File 'app/models/concerns/noticed/readable.rb', line 42

def mark_as_unread!
  update!(read_at: nil)
end

#mark_as_unseenObject



54
55
56
# File 'app/models/concerns/noticed/readable.rb', line 54

def mark_as_unseen
  update(seen_at: nil)
end

#mark_as_unseen!Object



58
59
60
# File 'app/models/concerns/noticed/readable.rb', line 58

def mark_as_unseen!
  update!(seen_at: nil)
end

#read?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'app/models/concerns/noticed/readable.rb', line 62

def read?
  read_at?
end

#seen?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/models/concerns/noticed/readable.rb', line 70

def seen?
  seen_at?
end

#unread?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'app/models/concerns/noticed/readable.rb', line 66

def unread?
  !read_at?
end

#unseen?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'app/models/concerns/noticed/readable.rb', line 74

def unseen?
  !seen_at?
end