Class: LightService::Context::ReservedKeysViaOrganizerVerifier

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

Instance Attribute Summary

Attributes inherited from KeyVerifier

#action, #context

Instance Method Summary collapse

Methods inherited from ReservedKeysVerifier

#error_to_throw, #keys, #reserved_keys, #throw_error_predicate

Methods inherited from KeyVerifier

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

Constructor Details

#initialize(context_data) ⇒ ReservedKeysViaOrganizerVerifier

rubocop:disable Lint/MissingSuper



120
121
122
# File 'lib/light-service/context/key_verifier.rb', line 120

def initialize(context_data)
  @context = LightService::Context.make(context_data)
end

Instance Method Details

#error_messageObject



129
130
131
132
133
134
# File 'lib/light-service/context/key_verifier.rb', line 129

def error_message
  "    reserved keys cannot be added to the context\n    reserved key: [\#{format_keys(violated_keys)}]\n  ERR\nend\n"

#violated_keysObject

rubocop:enable Lint/MissingSuper



125
126
127
# File 'lib/light-service/context/key_verifier.rb', line 125

def violated_keys
  context.keys.map(&:to_sym) & reserved_keys
end