Sha256: 4b76e0a54b900c6b3d9c92376ffe08e44588f1a843fe6f05129a5df881381894
Contents?: true
Size: 1.43 KB
Versions: 52
Compression:
Stored size: 1.43 KB
Contents
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
Version data entries
52 entries across 52 versions & 1 rubygems