Class: Protoboard::CircuitExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/protoboard/circuit_execution.rb

Overview

This class represents a circuit execution.

Constant Summary collapse

STATES =
%i[not_started success fail].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(circuit, state: :pending, value: nil, error: nil) ⇒ CircuitExecution

Returns a new instance of CircuitExecution.



11
12
13
14
15
16
# File 'lib/protoboard/circuit_execution.rb', line 11

def initialize(circuit, state: :pending, value: nil, error: nil)
  @circuit = circuit
  @state = state
  @value = value
  @error = error
end

Instance Attribute Details

#circuitObject (readonly)

Returns the value of attribute circuit.



9
10
11
# File 'lib/protoboard/circuit_execution.rb', line 9

def circuit
  @circuit
end

#errorObject (readonly)

Returns the value of attribute error.



9
10
11
# File 'lib/protoboard/circuit_execution.rb', line 9

def error
  @error
end

#stateObject (readonly)

Returns the value of attribute state.



9
10
11
# File 'lib/protoboard/circuit_execution.rb', line 9

def state
  @state
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/protoboard/circuit_execution.rb', line 9

def value
  @value
end

Instance Method Details

#fail?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/protoboard/circuit_execution.rb', line 18

def fail?
  @state == :fail
end