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

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

Constant Summary collapse

ERROR_CODE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns:

  • (Symbol)

Since:

  • 0.1.0

:required_key_not_found

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, verifiable_hash, required:, key_exists:) ⇒ 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



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 44

def initialize(key, verifiable_hash, required:, key_exists:)
  @key = key
  @verifiable_hash = verifiable_hash
  @required = required
  @optional = !required
  @key_exists = key_exists
  @success = required ? key_exists : true
  @failure = required ? !key_exists : false
  @error = (required && !key_exists) ? ERROR_CODE : nil
  @message = (required && !key_exists) ? "Required key :#{key} not found" : nil
end

Instance Attribute Details

#errorSymbol, NilClass (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:

  • (Symbol, NilClass)

Since:

  • 0.1.0



28
29
30
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 28

def error
  @error
end

#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



16
17
18
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 16

def key
  @key
end

#messageString, NilClass (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, NilClass)

Since:

  • 0.1.0



34
35
36
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 34

def message
  @message
end

#verifiable_hashSmartCore::Schema::Checker::VerifiableHash (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.



22
23
24
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 22

def verifiable_hash
  @verifiable_hash
end

Instance Method Details

#failure?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.1.0



68
69
70
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 68

def failure?
  @failure
end

#key_exists?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.1.0



76
77
78
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 76

def key_exists?
  @key_exists
end

#optional?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.1.0



84
85
86
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 84

def optional?
  @optional
end

#required?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.1.0



92
93
94
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 92

def required?
  @required
end

#success?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.1.0



60
61
62
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 60

def success?
  @success
end