Class: CConfig::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/cconfig/railtie.rb

Overview

This class will set up this gem for Ruby on Rails:

- On initialization this Railtie will set the `APP_CONFIG` global
  constant with the resulting merged values of the configuration.
- The `cconfig:info` rake task will be loaded.

Class Method Summary collapse

Class Method Details

.fetch_prefix(app) ⇒ Object

fetch_prefix returns a string containing the prefix to be used by our CConfig::Config instance.

app contains the Rails application as given by the railtie API.



51
52
53
54
55
56
57
58
59
# File 'lib/cconfig/railtie.rb', line 51

def self.fetch_prefix(app)
  if ENV['CCONFIG_PREFIX'].present?
    ENV['CCONFIG_PREFIX']
  elsif Rails::VERSION::MAJOR >= 6
    app.class.module_parent_name
  else
    app.class.parent_name.inspect
  end
end