class SmartCore::Schema::Checker
@api private @since 0.1.0 @version 0.3.0
Attributes
@return [SmartCore::Schema::Checker::Reconciler]
@api private @since 0.1.0
Public Class Methods
@return [void]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 15 def initialize @reconciler = Reconciler::Constructor.create @lock = SmartCore::Engine::Lock.new end
Public Instance Methods
@param definitions [Block] @return [void]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 58 def append_schema_definitions(&definitions) thread_safe { add_schema_definitions(&definitions) } end
@param verifiable_hash [Hash<String|Symbol,Any>] @return [SmartCore::Schema::Result]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 25 def check!(verifiable_hash) thread_safe do raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE) unless verifiable_hash.is_a?(Hash) Verifiable hash should be a type of ::Hash ERROR_MESSAGE reconciler.__match!(VerifiableHash.new(verifiable_hash)).complete! end end
@param another_checker [SmartCore::Schema::Checker] @return [SmartCore::Schema::Checker]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 67 def combine_with(another_checker) thread_safe { self } # TODO (0.x.0): merge the definitions and return self end
@param checker_invokations [Block] @return [void]
@api private @since 0.3.0
# File lib/smart_core/schema/checker.rb, line 40 def invoke_in_pipe(&checker_invokations) thread_safe { instance_eval(&checker_invokations) } end
@param strict_mode [NilClass, String, Symbol] @return [void]
@api private @since 0.3.0
# File lib/smart_core/schema/checker.rb, line 49 def set_strict_mode(strict_mode) thread_safe { apply_strict_mode(strict_mode) } end
Private Instance Methods
@param definitions [Block] @return [void]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 84 def add_schema_definitions(&definitions) raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE) unless block_given? Schema definitions is not provided (you should provide Block argument) ERROR_MESSAGE Reconciler::Constructor.append_definitions(reconciler, &definitions) end
@param strict_mode [NilClass, String, Symbol] @return [void]
@api private @since 0.3.0
# File lib/smart_core/schema/checker.rb, line 97 def apply_strict_mode(strict_mode) Reconciler::Constructor.set_strict_mode(reconciler, strict_mode) end
@param block [Block] @return [Any]
@api private @since 0.1.0
# File lib/smart_core/schema/checker.rb, line 106 def thread_safe(&block) @lock.synchronize(&block) end