class EnvironmentConfig::Builder
Attributes
config[R]
Public Class Methods
new(strip_prefix: nil)
click to toggle source
# File lib/environment_config/builder.rb, line 10 def initialize(strip_prefix: nil) @strip_prefix = strip_prefix @config = EnvironmentConfig.new end
Public Instance Methods
method_missing(method_name, *args)
click to toggle source
Calls superclass method
# File lib/environment_config/builder.rb, line 15 def method_missing(method_name, *args) if Types.known_type?(method_name) type = method_name key = args.shift convert_and_store(type, key, *args) else super end end
respond_to_missing?(method_name, *args)
click to toggle source
Calls superclass method
# File lib/environment_config/builder.rb, line 25 def respond_to_missing?(method_name, *args) Types.known_type?(method_name) || super end
Private Instance Methods
convert_and_store(type, key, *args)
click to toggle source
# File lib/environment_config/builder.rb, line 31 def convert_and_store(type, key, *args) value = TypedEnv.fetch(type, key, *args) store(key, value) end
store(key, value)
click to toggle source
# File lib/environment_config/builder.rb, line 36 def store(key, value) key = key[@strip_prefix.size..-1] if @strip_prefix && key.start_with?(@strip_prefix) config.store(key.downcase, value) end