Sha256: 081c5158308d5c10120286ffbbd6b3e0107674142623090c49707074676df38c
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true require_relative 'base' module UnifiedSettings module Handlers # Setting handler for Rails.application.credentials class Credentials < Base def defined?(key, case_sensitive: nil) key_arr = to_symbol_array(key) case_sensitive = case_sensitive?(case_sensitive) return true if nested_key_exists?(Rails.application.credentials, key_arr) return false if case_sensitive return true if nested_key_exists?( Rails.application.credentials, key_arr.map(&:upcase) ) return true if nested_key_exists?( Rails.application.credentials, key_arr.map(&:downcase) ) false end def get(key, case_sensitive: nil) key_arr = to_symbol_array(key) case_sensitive = case_sensitive?(case_sensitive) val = Rails.application.credentials.dig(*key_arr) return val unless val.nil? return nil if case_sensitive val = Rails.application.credentials.dig(*key_arr.map(&:downcase)) return val unless val.nil? Rails.application.credentials.dig(*key_arr.map(&:upcase)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unified_settings-0.1.1 | lib/unified_settings/handlers/credentials.rb |