Class: SmartCore::Schema::Checker::Rules::Requirement::Required Private

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

Instance Method Summary collapse

Constructor Details

#initialize(rule) ⇒ 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



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

def initialize(rule)
  @rule = rule
end

Instance Method Details

#validate(verifiable_hash) ⇒ SmartCore::Schema::Checker::Rules::Requirement::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.



20
21
22
23
24
25
26
27
# File 'lib/smart_core/schema/checker/rules/requirement/required.rb', line 20

def validate(verifiable_hash)
  SmartCore::Schema::Checker::Rules::Requirement::Result.new(
    rule.schema_key,
    verifiable_hash,
    required: true,
    key_exists: verifiable_hash.key?(rule.schema_key)
  )
end