Class: Rails::Engine::Configuration
- Inherits:
-
Railtie::Configuration
- Object
- Railtie::Configuration
- Rails::Engine::Configuration
- Defined in:
- lib/rails/engine/configuration.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- #autoload_once_paths ⇒ Object
- #autoload_paths ⇒ Object
- #eager_load_paths ⇒ Object
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
-
#gem(name, options = {}) ⇒ Object
Rails 3, by default, uses bundler, which shims the Kernel#gem method so that it should behave correctly for this deprecation.
-
#generators ⇒ Object
:nodoc:.
-
#initialize(root = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_paths ⇒ Object
- #load_paths=(paths) ⇒ Object
- #paths ⇒ Object
Methods inherited from Railtie::Configuration
#after_initialize, #app_generators, #app_middleware, #before_configuration, #before_eager_load, #before_initialize, #respond_to?, #to_prepare, #to_prepare_blocks
Constructor Details
#initialize(root = nil) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 |
# File 'lib/rails/engine/configuration.rb', line 9 def initialize(root=nil) super() @root = root end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rails::Railtie::Configuration
Instance Attribute Details
#autoload_once_paths ⇒ Object
50 51 52 |
# File 'lib/rails/engine/configuration.rb', line 50 def autoload_once_paths @autoload_once_paths ||= paths.autoload_once end |
#autoload_paths ⇒ Object
54 55 56 |
# File 'lib/rails/engine/configuration.rb', line 54 def autoload_paths @autoload_paths ||= paths.autoload_paths end |
#eager_load_paths ⇒ Object
46 47 48 |
# File 'lib/rails/engine/configuration.rb', line 46 def eager_load_paths @eager_load_paths ||= paths.eager_load end |
#root ⇒ Object
Returns the value of attribute root.
6 7 8 |
# File 'lib/rails/engine/configuration.rb', line 6 def root @root end |
Instance Method Details
#gem(name, options = {}) ⇒ Object
Rails 3, by default, uses bundler, which shims the Kernel#gem method so that it should behave correctly for this deprecation.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rails/engine/configuration.rb', line 70 def gem(name, = {}) super name, [:version] || ">= 0" require [:lib] || name rescue Gem::LoadError msg = "config.gem is deprecated, and you tried to activate the '#{name}' gem (#{.inspect}) using it.\n" if File.exist?("#{Rails.root}/Gemfile") msg << "Please add '#{name}' to your Gemfile." else msg << "Please update your application to use bundler." end ActiveSupport::Deprecation.warn(msg, caller) exit end |
#generators ⇒ Object
:nodoc:
36 37 38 39 40 |
# File 'lib/rails/engine/configuration.rb', line 36 def generators #:nodoc: ActiveSupport::Deprecation.warn "config.generators in Rails::Engine is deprecated. " << "Please use config.app_generators instead." super end |
#load_paths ⇒ Object
58 59 60 61 |
# File 'lib/rails/engine/configuration.rb', line 58 def load_paths ActiveSupport::Deprecation.warn "config.load_paths is deprecated. Please use config.autoload_paths instead." autoload_paths end |
#load_paths=(paths) ⇒ Object
63 64 65 66 |
# File 'lib/rails/engine/configuration.rb', line 63 def load_paths=(paths) ActiveSupport::Deprecation.warn "config.load_paths= is deprecated. Please use config.autoload_paths instead." self.autoload_paths = paths end |
#paths ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails/engine/configuration.rb', line 14 def paths @paths ||= begin paths = Rails::Paths::Root.new(@root) paths.app "app", :eager_load => true, :glob => "*" paths.app.controllers "app/controllers", :eager_load => true paths.app.helpers "app/helpers", :eager_load => true paths.app.models "app/models", :eager_load => true paths.app.mailers "app/mailers", :eager_load => true paths.app.views "app/views" paths.lib "lib", :load_path => true paths.lib.tasks "lib/tasks", :glob => "**/*.rake" paths.config "config" paths.config.initializers "config/initializers", :glob => "**/*.rb" paths.config.locales "config/locales", :glob => "*.{rb,yml}" paths.config.routes "config/routes.rb" paths.public "public" paths.public.javascripts "public/javascripts" paths.public.stylesheets "public/stylesheets" paths end end |