class Environmentor::ConfigManager
Attributes
schemas[R]
Public Class Methods
new(mod)
click to toggle source
# File lib/environmentor/config_manager.rb, line 9 def initialize(mod) @mod = mod @schemas = [] end
Public Instance Methods
delegate_from(mod)
click to toggle source
# File lib/environmentor/config_manager.rb, line 37 def delegate_from(mod) schemas.each do |s| s.map_to mod end end
delegate_to(mod)
click to toggle source
# File lib/environmentor/config_manager.rb, line 31 def delegate_to(mod) mod.environmentor.schemas.each do |s| s.map_to @mod end end
with_mapper(mappers, **opts, &block)
click to toggle source
# File lib/environmentor/config_manager.rb, line 14 def with_mapper(mappers, **opts, &block) defined_at = caller.first mappers = Array(mappers) if mappers.size > 1 && opts.size > 0 raise ArgumentError, "Cannot accept options when passing multiple mappers: they would be applied to all mappers. Create instances of mappers, pass options to those, and give me those instances." end mappers = mappers.map { |m| Environmentor::Mappers.deduce(m, **opts) }. compact Schema.new(mappers, defined_at: defined_at, **opts, &block).tap do |s| s.map_to @mod @schemas << s end end
Also aliased as: with_mappers