Class: SmartCore::Schema::Checker::Rules::Base Private

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

Direct Known Subclasses

Optional, Required

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_reconciler, schema_key, &nested_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.

Parameters:

Since:

  • 0.1.0

Version:

  • 0.8.0



39
40
41
42
43
44
45
# File 'lib/smart_core/schema/checker/rules/base.rb', line 39

def initialize(root_reconciler, schema_key, &nested_definitions)
  @root_reconciler = root_reconciler
  @schema_key = SmartCore::Schema::KeyControl.normalize(schema_key)
  @options = SmartCore::Schema::Checker::Rules::Options.new(self)
  @nested_reconciler = nil
  define_nested_reconciler(&nested_definitions)
end

Instance Attribute Details

#nested_reconcilerNilClass, SmartCore::Schema::Checker::Reconciler (readonly)

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



23
24
25
# File 'lib/smart_core/schema/checker/rules/base.rb', line 23

def nested_reconciler
  @nested_reconciler
end

#optionsSmartCore::Schema::Checker::Rules::Options (readonly)

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.



17
18
19
# File 'lib/smart_core/schema/checker/rules/base.rb', line 17

def options
  @options
end

#root_reconcilerSmartCore::Schema::Checker::Reconciler (readonly)

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.3.0



29
30
31
# File 'lib/smart_core/schema/checker/rules/base.rb', line 29

def root_reconciler
  @root_reconciler
end

#schema_keyString (readonly)

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:

  • (String)

Since:

  • 0.1.0



11
12
13
# File 'lib/smart_core/schema/checker/rules/base.rb', line 11

def schema_key
  @schema_key
end

Instance Method Details

#__verify!(verifiable_hash, matcher_options) ⇒ SmartCore::Schema::Checker::Rules::Verifier::Result

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:

Returns:

Since:

  • 0.1.0

Version:

  • 0.3.0



58
59
60
61
62
# File 'lib/smart_core/schema/checker/rules/base.rb', line 58

def __verify!(verifiable_hash, matcher_options)
  SmartCore::Schema::Checker::Rules::Verifier.verify!(
    self, matcher_options, verifiable_hash
  )
end

#filled(&nested_definitions) ⇒ self

Parameters:

  • nested_definitions (Block)

Returns:

  • (self)

Since:

  • 0.1.0

Version:

  • 0.8.0



84
85
86
87
88
89
# File 'lib/smart_core/schema/checker/rules/base.rb', line 84

def filled(&nested_definitions)
  tap do
    options.filled = SmartCore::Schema::Checker::Rules::Options::Filled.new(self)
    define_nested_reconciler(&nested_definitions)
  end
end

#requirementSmartCore::Schema::Checker::Rules::Requirement::Optional, SmartCore::Schema::Checker::Rules::Requirement::Required



# File 'lib/smart_core/schema/checker/rules/base.rb', line 47

#type(required_type, &nested_definitions) ⇒ self

Parameters:

  • required_type (String, Symbol, SmartCore::Types::Primitive)
  • nested_definitions (Block)

Returns:

  • (self)

Since:

  • 0.1.0

Version:

  • 0.8.0



71
72
73
74
75
76
# File 'lib/smart_core/schema/checker/rules/base.rb', line 71

def type(required_type, &nested_definitions)
  tap do
    options.type = SmartCore::Schema::Checker::Rules::Options::Type.new(self, required_type)
    define_nested_reconciler(&nested_definitions)
  end
end