Class: Stately::State::StateConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/stately/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ StateConfigurator

Returns a new instance of StateConfigurator.



66
67
68
# File 'lib/stately/state.rb', line 66

def initialize(&block)
  instance_eval(&block)
end

Instance Attribute Details

#after_transitionsObject (readonly)

Returns the value of attribute after_transitions.



63
64
65
# File 'lib/stately/state.rb', line 63

def after_transitions
  @after_transitions
end

#allow_from_statesObject (readonly)

Returns the value of attribute allow_from_states.



64
65
66
# File 'lib/stately/state.rb', line 64

def allow_from_states
  @allow_from_states
end

#before_transitionsObject (readonly)

Returns the value of attribute before_transitions.



63
64
65
# File 'lib/stately/state.rb', line 63

def before_transitions
  @before_transitions
end

#prevent_from_statesObject (readonly)

Returns the value of attribute prevent_from_states.



64
65
66
# File 'lib/stately/state.rb', line 64

def prevent_from_states
  @prevent_from_states
end

#validationsObject (readonly)

Returns the value of attribute validations.



63
64
65
# File 'lib/stately/state.rb', line 63

def validations
  @validations
end

Instance Method Details

#after_transition(options = {}) ⇒ Object



80
81
82
83
# File 'lib/stately/state.rb', line 80

def after_transition(options={})
  @after_transitions ||= []
  @after_transitions << options
end

#allow_from(*states) ⇒ Object



70
71
72
73
# File 'lib/stately/state.rb', line 70

def allow_from(*states)
  @allow_from_states ||= []
  @allow_from_states |= states.map(&:to_sym)
end

#before_transition(options = {}) ⇒ Object



75
76
77
78
# File 'lib/stately/state.rb', line 75

def before_transition(options={})
  @before_transitions ||= []
  @before_transitions << options
end

#prevent_from(*states) ⇒ Object



85
86
87
88
# File 'lib/stately/state.rb', line 85

def prevent_from(*states)
  @prevent_from_states ||= []
  @prevent_from_states |= states.map(&:to_sym)
end

#validate(options = {}) ⇒ Object



90
91
92
93
# File 'lib/stately/state.rb', line 90

def validate(options={})
  @validations ||= []
  @validations << options
end