Class: SmartCore::Schema::Checker::Reconciler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/schema/checker/reconciler.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.1.0

Version:

  • 0.8.0

Defined Under Namespace

Modules: Constructor, Matcher

Instance Method Summary collapse

Constructor Details

#initializevoid

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.

Since:

  • 0.1.0

Version:

  • 0.3.0



15
16
17
18
# File 'lib/smart_core/schema/checker/reconciler.rb', line 15

def initialize
  @rules = SmartCore::Schema::Checker::Rules.new
  @strict = Constructor::DEFAULT_STRICT_BEHAVIOR
end

Instance Method Details

#__contract_rulesSmartCore::Schema::Checker::Rules

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.

Returns:

Since:

  • 0.1.0

Version:

  • 0.8.0



43
44
45
# File 'lib/smart_core/schema/checker/reconciler.rb', line 43

def __contract_rules
  rules
end

#__extra_keys_contractSmartCore::Schema::Checker::Rules::ExtraKeys

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.



34
35
36
# File 'lib/smart_core/schema/checker/reconciler.rb', line 34

def __extra_keys_contract
  SmartCore::Schema::Checker::Rules::ExtraKeys
end

#__match!(verifiable_hash) ⇒ 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

Version:

  • 0.8.0



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

def __match!(verifiable_hash)
  SmartCore::Schema::Checker::Reconciler::Matcher.match(self, verifiable_hash)
end

#__strict?Boolean

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.

Returns:

  • (Boolean)

Since:

  • 0.3.0

Version:

  • 0.8.0



52
53
54
# File 'lib/smart_core/schema/checker/reconciler.rb', line 52

def __strict?
  @strict
end

#non_strict!void

This method returns an undefined value.

Since:

  • 0.3.0

Version:

  • 0.8.0



95
96
97
# File 'lib/smart_core/schema/checker/reconciler.rb', line 95

def non_strict!
  strict!(Constructor::STRICT_MODES[:non_strict])
end

#optional(schema_key, &nested_definitions) ⇒ SmartCore::Schema::Checker::Rules::Optional

Parameters:

  • schema_key (String, Symbol)
  • nested_definitions (Block)

Returns:

Since:

  • 0.1.0

Version:

  • 0.8.0



75
76
77
78
# File 'lib/smart_core/schema/checker/reconciler.rb', line 75

def optional(schema_key, &nested_definitions)
  rule = SmartCore::Schema::Checker::Rules::Optional.new(self, schema_key, &nested_definitions)
  rule.tap { rules[rule.schema_key] = rule }
end

#required(schema_key, &nested_definitions) ⇒ SmartCore::Schema::Checker::Rules::Required

Parameters:

  • schema_key (String, Symbol)
  • nested_definitions (Block)

Returns:

Since:

  • 0.1.0

Version:

  • 0.8.0



63
64
65
66
# File 'lib/smart_core/schema/checker/reconciler.rb', line 63

def required(schema_key, &nested_definitions)
  rule = SmartCore::Schema::Checker::Rules::Required.new(self, schema_key, &nested_definitions)
  rule.tap { rules[rule.schema_key] = rule }
end

#strict!(is_strict = Constructor::DEFAULT_STRICT_BEHAVIOR) ⇒ void

This method returns an undefined value.

Parameters:

  • is_strict (Boolean) (defaults to: Constructor::DEFAULT_STRICT_BEHAVIOR)

Since:

  • 0.3.0

Version:

  • 0.8.0



86
87
88
# File 'lib/smart_core/schema/checker/reconciler.rb', line 86

def strict!(is_strict = Constructor::DEFAULT_STRICT_BEHAVIOR)
  @strict = is_strict
end