Module: Configurethis

Defined in:
lib/configurethis.rb,
lib/configurethis/version.rb,
lib/configurethis/configuration.rb,
lib/configurethis/value_container.rb,
lib/configurethis/mock_configuration.rb,
lib/configurethis/configurethis_properties.rb

Defined Under Namespace

Classes: Configuration, ConfigurethisProperties, MockConfiguration, ValueContainer

Constant Summary collapse

VERSION =
"1.0.5"

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



41
42
43
# File 'lib/configurethis.rb', line 41

def method_missing(method, *args)
  configuration[method.to_s]
end

Class Method Details

.root_path=(path) ⇒ Object



9
10
11
# File 'lib/configurethis.rb', line 9

def root_path=(path)
  ConfigurethisProperties.root_path = path
end

.use_defaultsObject



13
14
15
# File 'lib/configurethis.rb', line 13

def use_defaults
  ConfigurethisProperties.use_defaults
end

Instance Method Details

#configuration_pathObject



18
19
20
# File 'lib/configurethis.rb', line 18

def configuration_path
  configuration.path
end

#configure_this_with(path) ⇒ Object



37
38
39
# File 'lib/configurethis.rb', line 37

def configure_this_with(path)
  @configuration_file = path
end

#reload_configurationObject



45
46
47
48
# File 'lib/configurethis.rb', line 45

def reload_configuration
  @configuration = nil
  return self
end

#set_root=(key) ⇒ Object



22
23
24
# File 'lib/configurethis.rb', line 22

def set_root=(key)
  configuration.root = key.to_s
end

#test_with(values) ⇒ Object

Meant for testing different scenarios and avoid using the real configuration values in your tests/specs.

To use, pass a hash that represents the values you like so that it mirrors the yml files structure.



33
34
35
# File 'lib/configurethis.rb', line 33

def test_with(values)
  @configuration = MockConfiguration.new values
end