Class: Marshalsea::Marshal::BoundaryDetector::Decision
- Inherits:
-
Object
- Object
- Marshalsea::Marshal::BoundaryDetector::Decision
- Defined in:
- lib/marshalsea/marshal/boundary_detector.rb
Constant Summary collapse
- STATE_PROCEED =
:proceed- STATE_BLOCKED =
:blocked- STATE_OBSERVED =
:observed- STATES =
[STATE_PROCEED, STATE_BLOCKED, STATE_OBSERVED].freeze
- STATE_PREDICATES =
%i[proceed? blocked? observed?].freeze
- UNKNOWN_STATE =
"unknown decision state %p, expected one of %s"
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#snapshot ⇒ Object
readonly
Returns the value of attribute snapshot.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #blocked? ⇒ Boolean
-
#initialize(state:, reason: nil, snapshot: nil, result: nil) ⇒ Decision
constructor
A new instance of Decision.
- #observed? ⇒ Boolean
- #proceed? ⇒ Boolean
Constructor Details
#initialize(state:, reason: nil, snapshot: nil, result: nil) ⇒ Decision
Returns a new instance of Decision.
70 71 72 73 74 75 76 77 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 70 def initialize(state:, reason: nil, snapshot: nil, result: nil) raise ArgumentError, format(UNKNOWN_STATE, state, STATES.join(", ")) unless STATES.include?(state) @state = state @reason = reason @snapshot = snapshot @result = result end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
68 69 70 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 68 def reason @reason end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
68 69 70 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 68 def result @result end |
#snapshot ⇒ Object (readonly)
Returns the value of attribute snapshot.
68 69 70 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 68 def snapshot @snapshot end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
68 69 70 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 68 def state @state end |
Instance Method Details
#blocked? ⇒ Boolean
83 84 85 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 83 def blocked? state == STATE_BLOCKED end |
#observed? ⇒ Boolean
87 88 89 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 87 def observed? state == STATE_OBSERVED end |
#proceed? ⇒ Boolean
79 80 81 |
# File 'lib/marshalsea/marshal/boundary_detector.rb', line 79 def proceed? state == STATE_PROCEED end |