Sha256: 173e36b399cd57f76e695f9132c86362e6eef0433c229a1c3454cdb4ac28b38e
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 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 logger config.logger 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-2.2.3 | lib/eco/api/session/config/base_config.rb |