Class: Axn::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/axn/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timeObject

Framework field accessors



21
22
23
# File 'lib/axn/context.rb', line 21

def elapsed_time
  @elapsed_time
end

#exceptionObject (readonly)

Returns the value of attribute exception.



22
23
24
# File 'lib/axn/context.rb', line 22

def exception
  @exception
end

#exposed_dataObject

Framework field accessors



21
22
23
# File 'lib/axn/context.rb', line 21

def exposed_data
  @exposed_data
end

#provided_dataObject

Framework field accessors



21
22
23
# File 'lib/axn/context.rb', line 21

def provided_data
  @provided_data
end

Instance Method Details

#__combined_dataObject

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

Returns:

  • (Boolean)


32
# File 'lib/axn/context.rb', line 32

def __early_completion? = @early_completion || false

#__early_completion_messageObject



46
# File 'lib/axn/context.rb', line 46

def __early_completion_message = @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(message)
  @early_completion_message = message unless message == Axn::Internal::EarlyCompletion.new.message
  @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

Returns:

  • (Boolean)


17
# File 'lib/axn/context.rb', line 17

def failed? = @failure || false

#finalized?Boolean

Returns:

  • (Boolean)


18
# File 'lib/axn/context.rb', line 18

def finalized? = @finalized || false

#ok?Boolean

Framework state methods

Returns:

  • (Boolean)


16
# File 'lib/axn/context.rb', line 16

def ok? = !@failure