lib/eco/api/session/config/base_config.rb



module Eco
  module API
    class Session
      class Config
        class BaseConfig < Hash
          
          attr_reader :config

          def initialize(config:)
            super(nil)
            @config = config
          end

          def clone(config:)
            keys.each_with_object(self.class.new(config: config)) do |key, cnf|
              begin
                cnf[key] = self[key].clone(config: cnf)
              rescue ArgumentError
                begin
                  cnf[key] = self[key].clone
                rescue TypeError
                  cnf[key] = self[key]
                end
              end
            end
          end

        end
      end
    end
  end
end