Class: Merlin::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/merlin/configuration.rb

Constant Summary collapse

REMOTE_FETCH_TIMEOUT =

4 seconds

4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file_path, environment, logger = Logger.new(STDOUT), connection = nil) ⇒ Configuration

Returns a new instance of Configuration.



33
34
35
36
37
38
39
40
# File 'lib/merlin/configuration.rb', line 33

def initialize(config_file_path, environment, logger = Logger.new(STDOUT), connection = nil)
  @environment = environment
  @logger = logger
  @local_raw = from_file(config_file_path)
  @remote_raw = merlin_server ? from_server(connection) : {}
  @raw = @remote_raw.deep_merge(@local_raw)
  @struct = OpenStruct.deep(raw.clone, true)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



42
43
44
# File 'lib/merlin/configuration.rb', line 42

def method_missing(name, *args, &block)
  @struct.send(name, *args, &block)
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



31
32
33
# File 'lib/merlin/configuration.rb', line 31

def raw
  @raw
end