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

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/types/primitive/invariant_control/single/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, checked_value, is_valid_check) ⇒ 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/single/result.rb', line 25

def initialize(invariant, checked_value, is_valid_check)
  @invariant = invariant
  @checked_value = checked_value
  @is_valid_check = is_valid_check
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/single/result.rb', line 16

def checked_value
  @checked_value
end

#invariantSmartCore::Types::Primitive::InvariantControl::Single (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.



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

def invariant
  @invariant
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.2.0



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

def error_codes
  success? ? [] : [invariant.name]
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/single/result.rb', line 43

def failure?
  !success?
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/single/result.rb', line 35

def success?
  is_valid_check
end