module SmartCore::Schema::Checker::Reconciler::Constructor

@api private @since 0.1.0 @version 0.3.0

Constants

DEFAULT_STRICT_BEHAVIOR

@return [Boolean]

@pai private @since 0.3.0

STRICT_MODES

@return [Hash<String,Boolean>]

@api private @since 0.3.0

Public Class Methods

append_definitions(reconciler, &definitions) click to toggle source

@param reconciler [SmartCore::Schema::Checker::Reconciler] @param definitions [Proc] @return [void]

@api private @since 0.1.0

# File lib/smart_core/schema/checker/reconciler/constructor.rb, line 26
def append_definitions(reconciler, &definitions)
  reconciler.instance_eval(&definitions)
end
create(&definitions) click to toggle source

@param definitions [Proc, NilClass] @return [SmarCore::Schema::Checker::Reconciler]

@api private @since 0.1.0

# 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) click to toggle source

@param reconciler [SmartCore::Schema::Checker::Reconciler] @param strict_mode [NilClass, String, Symbol] @return [void]

@api private @since 0.3.0

# 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