Sha256: c9a4efb3308dba150bf08c551f1630dfca6f849eb21a15495af918f469f73f27
Contents?: true
Size: 875 Bytes
Versions: 9
Compression:
Stored size: 875 Bytes
Contents
class MessageStateMachine include Statesman::Machine state :pending, initial: true state :unread state :read transition from: :pending, to: :unread transition from: :pending, to: :read transition from: :unread, to: :read transition from: :read, to: :unread before_transition(from: :pending, to: :read) do |message| message.read_at = Time.zone.now unless message.read_at end before_transition(from: :unread, to: :read) do |message| message.read_at = Time.zone.now unless message.read_at end before_transition(from: :read, to: :unread) do |message| message.read_at = nil end after_transition(from: :pending, to: :read) do |message| message.index! end after_transition(from: :unread, to: :read) do |message| message.index! end after_transition(from: :read, to: :unread) do |message| message.index! end end
Version data entries
9 entries across 9 versions & 1 rubygems