Class: NucleusCore::Operation::Context
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- NucleusCore::Operation::Context
- Defined in:
- lib/nucleus_core/operation.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#failure ⇒ Object
readonly
Returns the value of attribute failure.
Instance Method Summary collapse
- #fail!(message, attrs = {}) ⇒ Object
-
#initialize(attrs = {}) ⇒ Context
constructor
A new instance of Context.
- #success? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ Context
Returns a new instance of Context.
18 19 20 21 22 |
# File 'lib/nucleus_core/operation.rb', line 18 def initialize(attrs={}) @failure = false super(attrs) end |
Instance Attribute Details
#failure ⇒ Object (readonly)
Returns the value of attribute failure.
16 17 18 |
# File 'lib/nucleus_core/operation.rb', line 16 def failure @failure end |
Instance Method Details
#fail!(message, attrs = {}) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/nucleus_core/operation.rb', line 28 def fail!(, attrs={}) @failure = true self. = self.exception = attrs.delete(:exception) raise Context::Error, end |
#success? ⇒ Boolean
24 25 26 |
# File 'lib/nucleus_core/operation.rb', line 24 def success? !@failure end |