Module: Olyx::Guardrails::PolicyComponents::ConfigurationHash

Defined in:
lib/olyx/guardrails/policy/configuration_hash.rb

Overview

Normalizes String/Symbol keyed policy configuration hashes.

Class Method Summary collapse

Class Method Details

.call(config) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/olyx/guardrails/policy/configuration_hash.rb', line 10

def call(config)
  raise ArgumentError, 'policy configuration must be a Hash' unless config.is_a?(Hash)

  config.to_h { |key, value| [key.to_sym, value] }
rescue NoMethodError
  raise ArgumentError, 'policy configuration keys must be Strings or Symbols'
end