Class: Axn::Context
- Inherits:
-
Object
- Object
- Axn::Context
- Defined in:
- lib/axn/context.rb
Instance Attribute Summary collapse
-
#elapsed_time ⇒ Object
readonly
Framework field accessors.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#exposed_data ⇒ Object
Framework field accessors.
-
#provided_data ⇒ Object
Framework field accessors.
Instance Method Summary collapse
-
#__combined_data ⇒ Object
INTERNAL: base for further filtering (for logging) or providing user with usage hints.
- #__early_completion? ⇒ Boolean
- #__early_completion_message ⇒ Object
- #__finalize! ⇒ Object
- #__record_early_completion(message) ⇒ Object
- #__record_exception(e) ⇒ Object
- #failed? ⇒ Boolean
- #finalized? ⇒ Boolean
-
#initialize(**provided_data) ⇒ Context
constructor
A new instance of Context.
-
#ok? ⇒ Boolean
Framework state methods.
Constructor Details
#initialize(**provided_data) ⇒ Context
Returns a new instance of Context.
5 6 7 8 9 10 11 12 13 |
# File 'lib/axn/context.rb', line 5 def initialize(**provided_data) @provided_data = provided_data @exposed_data = {} # Framework-managed fields @failure = false @exception = nil @elapsed_time = nil end |
Instance Attribute Details
#elapsed_time ⇒ Object
Framework field accessors
21 22 23 |
# File 'lib/axn/context.rb', line 21 def elapsed_time @elapsed_time end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
22 23 24 |
# File 'lib/axn/context.rb', line 22 def exception @exception end |
#exposed_data ⇒ Object
Framework field accessors
21 22 23 |
# File 'lib/axn/context.rb', line 21 def exposed_data @exposed_data end |
#provided_data ⇒ Object
Framework field accessors
21 22 23 |
# File 'lib/axn/context.rb', line 21 def provided_data @provided_data end |
Instance Method Details
#__combined_data ⇒ Object
INTERNAL: base for further filtering (for logging) or providing user with usage hints
30 |
# File 'lib/axn/context.rb', line 30 def __combined_data = @provided_data.merge(@exposed_data) |
#__early_completion? ⇒ Boolean
32 |
# File 'lib/axn/context.rb', line 32 def __early_completion? = @early_completion || false |
#__early_completion_message ⇒ Object
46 |
# File 'lib/axn/context.rb', line 46 def = @early_completion_message.presence |
#__finalize! ⇒ Object
48 49 50 |
# File 'lib/axn/context.rb', line 48 def __finalize! @finalized = true end |
#__record_early_completion(message) ⇒ Object
40 41 42 43 44 |
# File 'lib/axn/context.rb', line 40 def __record_early_completion() @early_completion_message = unless == Axn::Internal::EarlyCompletion.new. @early_completion = true @finalized = true end |
#__record_exception(e) ⇒ Object
34 35 36 37 38 |
# File 'lib/axn/context.rb', line 34 def __record_exception(e) @exception = e @failure = true @finalized = true end |
#failed? ⇒ Boolean
17 |
# File 'lib/axn/context.rb', line 17 def failed? = @failure || false |
#finalized? ⇒ Boolean
18 |
# File 'lib/axn/context.rb', line 18 def finalized? = @finalized || false |
#ok? ⇒ Boolean
Framework state methods
16 |
# File 'lib/axn/context.rb', line 16 def ok? = !@failure |