Module: SSM

Defined in:
lib/ssm/ssm.rb,
lib/ssm/event.rb,
lib/ssm/errors.rb,
lib/ssm/version.rb,
lib/ssm/validation.rb

Defined Under Namespace

Modules: ClassMethods, Event Classes: InvalidTransition

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
# File 'lib/ssm/ssm.rb', line 2

def self.included(base)
  base.extend SSM::ClassMethods
end

Instance Method Details

#transition(from:) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/ssm/ssm.rb', line 38

def transition(from:)
  valid_states = [from].flatten

  if valid_states.include?(self.state.to_sym)
    return yield
  end
  raise SSM::InvalidTransition
end