Class: EnvironmentConfig::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/environment_config/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strip_prefix: nil) ⇒ Builder

Returns a new instance of Builder.



10
11
12
13
# File 'lib/environment_config/builder.rb', line 10

def initialize(strip_prefix: nil)
  @strip_prefix = strip_prefix
  @config = EnvironmentConfig.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
# 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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/environment_config/builder.rb', line 8

def config
  @config
end

Instance Method Details

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/environment_config/builder.rb', line 25

def respond_to_missing?(method_name, *args)
  Types.known_type?(method_name) || super
end