Class: Eco::API::Session::Config::BaseConfig
- Inherits:
-
Hash
show all
- Defined in:
- lib/eco/api/session/config/base_config.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Hash
#deep_merge, #deep_merge!
Constructor Details
#initialize(config:) ⇒ BaseConfig
Returns a new instance of BaseConfig.
28
29
30
31
|
# File 'lib/eco/api/session/config/base_config.rb', line 28
def initialize(config:)
super(nil)
@config = config
end
|
Instance Attribute Details
Returns the value of attribute config.
6
7
8
|
# File 'lib/eco/api/session/config/base_config.rb', line 6
def config
@config
end
|
Class Method Details
.attr_key(*attrs) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/eco/api/session/config/base_config.rb', line 9
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
|
Instance Method Details
37
38
39
|
# File 'lib/eco/api/session/config/base_config.rb', line 37
def apis
config.apis
end
|
#clone(config:) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/eco/api/session/config/base_config.rb', line 41
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
|
#file_manager ⇒ Object
33
34
35
|
# File 'lib/eco/api/session/config/base_config.rb', line 33
def file_manager
config.file_manager
end
|