Class: SmartCore::Types::Primitive::InvariantControl::Chain::Result Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/types/primitive/invariant_control/chain/result.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invariant_chain, checked_value, invariant_results) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 0.2.0



25
26
27
28
29
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 25

def initialize(invariant_chain, checked_value, invariant_results)
  @invariant_chain = invariant_chain
  @checked_value = checked_value
  @invariant_results = invariant_results
end

Instance Attribute Details

#checked_valueAny (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Any)

Since:

  • 0.2.0



16
17
18
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 16

def checked_value
  @checked_value
end

#invariant_chainSmartCore::Types::Primitive::invariantControl::Chain (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (SmartCore::Types::Primitive::invariantControl::Chain)

Since:

  • 0.2.0



10
11
12
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 10

def invariant_chain
  @invariant_chain
end

Instance Method Details

#error_codesArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array<String>)

Since:

  • 0.1.0



51
52
53
54
55
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 51

def error_codes
  invariant_results.select(&:failure?).map! do |invariant_result|
    "#{invariant_chain.name}.#{invariant_result.invariant.name}".tap(&:freeze)
  end
end

#failure?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 0.2.0



43
44
45
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 43

def failure?
  invariant_results.any?(&:failure?)
end

#success?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 0.2.0



35
36
37
# File 'lib/smart_core/types/primitive/invariant_control/chain/result.rb', line 35

def success?
  invariant_results.all?(&:success?)
end