Module: Rails::Paths::PathParent

Included in:
Path, Root
Defined in:
railties/lib/rails/paths.rb

Overview

:nodoc:

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'railties/lib/rails/paths.rb', line 6

def method_missing(id, *args)
  match = id.to_s.match(/^(.*)=$/)
  full  = [@current, $1 || id].compact.join("/")

  ActiveSupport::Deprecation.warn 'Accessing paths using dot style as in `config.paths.app.controller` is deprecated. Please use ' <<
    '`config.paths["app/controller"]` style instead.'

  if match || args.any?
    @root[full] = Path.new(@root, full, *args)
  elsif path = @root[full]
    path
  else
    super
  end
end