Class: EndState::Guard
- Inherits:
-
Object
- Object
- EndState::Guard
- Includes:
- Messages
- Defined in:
- lib/end_state/guard.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #allowed? ⇒ Boolean
- #failed ⇒ Object
-
#initialize(object, state, params) ⇒ Guard
constructor
A new instance of Guard.
- #passed ⇒ Object
- #will_allow? ⇒ Boolean
Methods included from Messages
Constructor Details
#initialize(object, state, params) ⇒ Guard
6 7 8 9 10 |
# File 'lib/end_state/guard.rb', line 6 def initialize(object, state, params) @object = object @state = state @params = params end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4 5 6 |
# File 'lib/end_state/guard.rb', line 4 def object @object end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/end_state/guard.rb', line 4 def params @params end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
4 5 6 |
# File 'lib/end_state/guard.rb', line 4 def state @state end |
Instance Method Details
#allowed? ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/end_state/guard.rb', line 12 def allowed? will_allow?.tap do |result| failed unless result passed if result end end |
#failed ⇒ Object
26 27 |
# File 'lib/end_state/guard.rb', line 26 def failed end |
#passed ⇒ Object
23 24 |
# File 'lib/end_state/guard.rb', line 23 def passed end |
#will_allow? ⇒ Boolean
19 20 21 |
# File 'lib/end_state/guard.rb', line 19 def will_allow? false end |