module Eco module API class Session class Config class BaseConfig < Hash attr_reader :config class << self def attr_key(*attrs) attrs.each do |attr| method = "#{attr}".freeze if self.instance_methods.include?(method.to_sym) puts "WARNING (#{self}): redefining method already defined '#{method}'." end define_method method do self[method] end define_method "#{method}=" do |value| self[method] = value end end self end end def initialize(config:) super(nil) @config = config end def file_manager config.file_manager end def apis config.apis 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