Module: SmartCore::Schema::Checker::Rules::ExtraKeys Private

Defined in:
lib/smart_core/schema/checker/rules/extra_keys.rb,
lib/smart_core/schema/checker/rules/extra_keys/failure.rb,
lib/smart_core/schema/checker/rules/extra_keys/success.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

Defined Under Namespace

Classes: Failure, Result, Success

Class Method Summary collapse

Class Method Details

.__verify!(verifiable_hash, rules, matcher_options) ⇒ SmartCore::Schema::Checker::Rules::ExtraKeys::Success, SmartCore::Schema::Checker::Rules::ExtraKeys::Failure

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.



21
22
23
24
25
26
27
28
29
# File 'lib/smart_core/schema/checker/rules/extra_keys.rb', line 21

def __verify!(verifiable_hash, rules, matcher_options)
  extra_keys = verifiable_hash.keys - rules.keys

  if extra_keys.empty? || (extra_keys.any? && !matcher_options.strict_schema?)
    Success.new(extra_keys, matcher_options)
  else
    Failure.new(extra_keys, matcher_options)
  end
end