Skip to content

Instantly share code, notes, and snippets.

@ffloyd
Created April 6, 2016 12:48
Show Gist options
  • Save ffloyd/cd11137ce21d2bf0b7ab2118754cfe69 to your computer and use it in GitHub Desktop.
Save ffloyd/cd11137ce21d2bf0b7ab2118754cfe69 to your computer and use it in GitHub Desktop.
statesman
# use only for possible transitions check
class IndividualWebinar::Workflow
include Statesman::Machine
def initialize(webinar)
@webinar = webinar
end
state :planned
state :waiting_for_teacher
state :waiting_for_student
state :on_air
state :finished
transition from: :planned, to: [:waiting_for_teacher, :cancelled_by_manager, :cancelled_by_teacher, :cancelled_by_student]
transition from: :waiting_for_teacher, to: [:waiting_for_student, :missed_by_teacher]
transition from: :waiting_for_student, to: [:on_air, :missed_by_student]
transition from: :on_air, to: [:finished]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment