Class: FunctionalLightService::Context::ReservedKeysVerifier

Inherits:
KeyVerifier show all
Defined in:
lib/functional-light-service/context/key_verifier.rb

Instance Attribute Summary

Attributes inherited from KeyVerifier

#action, #context

Instance Method Summary collapse

Methods inherited from KeyVerifier

#are_all_keys_in_context?, #format_keys, #initialize, #keys_not_found, #verify, verify_keys

Constructor Details

This class inherits a constructor from FunctionalLightService::Context::KeyVerifier

Instance Method Details

#error_messageObject



96
97
98
99
# File 'lib/functional-light-service/context/key_verifier.rb', line 96

def error_message
  "promised or expected keys cannot be a " \
    "reserved key: [#{format_keys(violated_keys)}]"
end

#error_to_throwObject



105
106
107
# File 'lib/functional-light-service/context/key_verifier.rb', line 105

def error_to_throw
  ReservedKeysInContextError
end

#keysObject



101
102
103
# File 'lib/functional-light-service/context/key_verifier.rb', line 101

def keys
  violated_keys
end

#reserved_keysObject



113
114
115
# File 'lib/functional-light-service/context/key_verifier.rb', line 113

def reserved_keys
  %i[message error_code current_action].freeze
end

#throw_error_predicate(keys) ⇒ Object



109
110
111
# File 'lib/functional-light-service/context/key_verifier.rb', line 109

def throw_error_predicate(keys)
  keys.any?
end

#violated_keysObject



92
93
94
# File 'lib/functional-light-service/context/key_verifier.rb', line 92

def violated_keys
  (action.promised_keys + action.expected_keys) & reserved_keys
end