Sha256: 0576289f01b7126ece832346fd7f0cce06ae8243a3ea9f22636b97b014b50f0e
Contents?: true
Size: 583 Bytes
Versions: 6
Compression:
Stored size: 583 Bytes
Contents
require 'hashie' require 'active_support/core_ext/string' module PortalConnectors class SafeSettingsHash < Hash include Hashie::Extensions::IndifferentAccess include Hashie::Extensions::MethodAccess def [](key) fetch(key).tap do |value| raise(KeyError, "Key #{key} not assigned to non-blank value") if value.blank? end end def []=(key, value) if PortalConnectors.test_mode raise(KeyError, "Key #{key} not assigned outside of test_mode") unless has_key?(key) end indifferent_writer(key, value) end end end
Version data entries
6 entries across 6 versions & 1 rubygems