Class: Stately::State::StateConfigurator
- Inherits:
-
Object
- Object
- Stately::State::StateConfigurator
- Defined in:
- lib/stately/state.rb
Instance Attribute Summary collapse
-
#after_transitions ⇒ Object
readonly
Returns the value of attribute after_transitions.
-
#allow_from_states ⇒ Object
readonly
Returns the value of attribute allow_from_states.
-
#before_transitions ⇒ Object
readonly
Returns the value of attribute before_transitions.
-
#prevent_from_states ⇒ Object
readonly
Returns the value of attribute prevent_from_states.
-
#validations ⇒ Object
readonly
Returns the value of attribute validations.
Instance Method Summary collapse
- #after_transition(options = {}) ⇒ Object
- #allow_from(*states) ⇒ Object
- #before_transition(options = {}) ⇒ Object
-
#initialize(&block) ⇒ StateConfigurator
constructor
A new instance of StateConfigurator.
- #prevent_from(*states) ⇒ Object
- #validate(options = {}) ⇒ Object
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_transitions ⇒ Object (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_states ⇒ Object (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_transitions ⇒ Object (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_states ⇒ Object (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 |
#validations ⇒ Object (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(={}) @after_transitions ||= [] @after_transitions << 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(={}) @before_transitions ||= [] @before_transitions << 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(={}) @validations ||= [] @validations << end |