Module: CoConfig

Defined in:
lib/co_config.rb,
lib/co_config/errors.rb,
lib/co_config/loader.rb,
lib/co_config/railtie.rb,
lib/co_config/version.rb

Defined Under Namespace

Modules: Loader Classes: Configuration, ConfigurationLoadError, FailedValidationError, MissingConfigError, MissingFileError, Railtie

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.config_path(file) ⇒ Object



15
16
17
# File 'lib/co_config.rb', line 15

def config_path(file)
  Rails.root.join('config', file)
end

.envObject



19
20
21
# File 'lib/co_config.rb', line 19

def env
  Rails.env
end

.load(location = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/co_config.rb', line 23

def load(location = nil)
  if location.present?
    path = Pathname.new(location)
    Configuration.new(path.join('configuration.rb'), path)
  else
    file = config_path('configuration.rb')
    Configuration.new(file)
  end
end