Module: SmartCore::Schema::Checker::Reconciler::Constructor Private

Defined in:
lib/smart_core/schema/checker/reconciler/constructor.rb

Overview

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

Since:

  • 0.1.0

Version:

  • 0.3.0

Constant Summary collapse

STRICT_MODES =

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

Returns:

  • (Hash<String,Boolean>)

Since:

  • 0.3.0

{ strict: true, 'strict' => true, non_strict: false, 'non_strict' => true }.freeze
DEFAULT_STRICT_BEHAVIOR =

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

Returns:

  • (Boolean)

Since:

  • 0.3.0

STRICT_MODES[:strict]

Class Method Summary collapse

Class Method Details

.append_definitions(reconciler, &definitions) ⇒ 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:

Since:

  • 0.1.0



26
27
28
# File 'lib/smart_core/schema/checker/reconciler/constructor.rb', line 26

def append_definitions(reconciler, &definitions)
  reconciler.instance_eval(&definitions)
end

.create(&definitions) ⇒ SmarCore::Schema::Checker::Reconciler

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:

  • definitions (Proc, NilClass)

Returns:

  • (SmarCore::Schema::Checker::Reconciler)

Since:

  • 0.1.0



54
55
56
57
58
# File 'lib/smart_core/schema/checker/reconciler/constructor.rb', line 54

def create(&definitions)
  SmartCore::Schema::Checker::Reconciler.new.tap do |reconciler|
    append_definitions(reconciler, &definitions) if block_given?
  end
end

.set_strict_mode(reconciler, strict_mode) ⇒ 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:

Since:

  • 0.3.0



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/smart_core/schema/checker/reconciler/constructor.rb', line 36

def set_strict_mode(reconciler, strict_mode)
  return if strict_mode == nil

  is_strict = STRICT_MODES.fetch(strict_mode) do
    raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE)
      Unsupported strict mode "#{strict_mode}".
      SmartCore::Schema supports "strict" and "non_strict" modes only.
    ERROR_MESSAGE
  end

  reconciler.strict!(is_strict)
end