Class: SmartCore::Types::Primitive::InvariantControl::Factory::ChainDefinitionContext Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/types/primitive/invariant_control/factory/chain_definition_context.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(chain_name) ⇒ void

Parameters:

  • chain_name (String)

Since:

  • 0.2.0



17
18
19
# File 'lib/smart_core/types/primitive/invariant_control/factory/chain_definition_context.rb', line 17

def initialize(chain_name)
  @___chain___ = SmartCore::Types::Primitive::InvariantControl::Chain.new(chain_name)
end

Instance Attribute Details

#___chain___SmartCore::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.



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

def ___chain___
  @___chain___
end

Instance Method Details

#invariant(invariant_name, &invariant_definition) ⇒ 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.

This method returns an undefined value.

Parameters:

  • invariant_name (String, Symbol)
  • invariant_definition (Block)

Since:

  • 0.2.0



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/smart_core/types/primitive/invariant_control/factory/chain_definition_context.rb', line 27

def invariant(invariant_name, &invariant_definition)
  SmartCore::Types::Primitive::Factory::DefinitionContext.vaildate_invariant_attributes!(
    invariant_name,
    &invariant_definition
  )

  ___chain___.add_invariant(
    SmartCore::Types::Primitive::InvariantControl::Single.create(
      invariant_name, invariant_definition
    )
  )
end