lib/active_settings/config.rb
# Recursively converts Hashes to Options (including Hashes inside Arrays)
# rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
Recursively converts Hashes to Options (including Hashes inside Arrays)
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
Recursively converts Hashes to Options ( including Hashes inside Arrays ) rubocop : disable Metrics / MethodLength Metrics / CyclomaticComplexity Metrics / PerceivedComplexity Metrics / AbcSize
def __convert(hash)
      s = ActiveSettings::Config.new
      hash.each do |key, value|
        key = key.to_s if !key.respond_to?(:to_sym) && key.respond_to?(:to_s)
        new_val =
          case value
          when Hash
            value['type'] == 'hash' ? value['contents'] : __convert(value)
          when Array
            value.collect { |e| e.instance_of?(Hash) ? __convert(e) : e }
          else
            value
          end
        s[key] = new_val
      end
      s
    end
def __convert ( hash ) s = ActiveSettings :: Config . new hash . each do | key , value | key = key . to_s if ! key . respond_to? ( :to_sym ) && key . respond_to? ( :to_s ) new_val = case value when Hash value [ 'type' ] == 'hash' ? value [ 'contents' ] : __convert ( value ) when Array value . collect { | e | e . instance_of? ( Hash ) ? __convert ( e ) : e } else value end s [ key ] = new_val end s end
Recursively converts Hashes to Options (including Hashes inside Arrays)
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
Recursively converts Hashes to Options ( including Hashes inside Arrays ) rubocop : disable Metrics / MethodLength Metrics / CyclomaticComplexity Metrics / PerceivedComplexity Metrics / AbcSize
hash