Sha256: a162ad1580b7907e15fd6ac0f7b40d5727e53f26efc6a1c38586d11cd2659576

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

class MachineTestSubject
  include Transitions

  state_machine initial: :open do
    state :open
    state :closed

    event :shutdown do
      transitions from: :open, to: :closed
    end

    event :timeout do
      transitions from: :open, to: :closed
    end

    event :restart do
      transitions from: :closed, to: :open, guard: :restart_allowed?
    end
  end

  def restart_allowed?(allowed = true)
    allowed
  end

  def event_failed(*)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
transitions-1.0.0 test/machine/machine_template.rb
transitions-0.2.1 test/machine/machine_template.rb