Sha256: 328b962ba01d3257f7a367e3b1376730e335fd5b33fb4d9179aad8896d07f444
Contents?: true
Size: 562 Bytes
Versions: 5
Compression:
Stored size: 562 Bytes
Contents
# frozen_string_literal: true module RequestHandler module Concerns module ConfigHelper def lookup!(hash, key) lookup(hash, key) || (raise NoConfigAvailableError, key.to_sym => 'is not configured') end def lookup(config, key) config.dig(*symbolize_key(key)) end def symbolize_key(key) key.split('.').map(&:to_sym) end def deep_to_h(obj) obj.to_h.transform_values do |v| v.is_a?(OpenStruct) || v.is_a?(Struct) ? deep_to_h(v) : v end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems