Class: Rails::Application::Configuration::Custom

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/application/configuration.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeCustom

Returns a new instance of Custom.



610
611
612
# File 'lib/rails/application/configuration.rb', line 610

def initialize
  @configurations = Hash.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



614
615
616
617
618
619
620
621
622
623
624
# File 'lib/rails/application/configuration.rb', line 614

def method_missing(method, *args)
  if method.end_with?("=")
    @configurations[:"#{method[0..-2]}"] = args.first
  elsif args.empty?
    @configurations.fetch(method) {
      @configurations[method] = ActiveSupport::OrderedOptions.new
    }
  else
    raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 0) when reading configuration `#{method}`"
  end
end

Instance Method Details

#respond_to_missing?(symbol, _) ⇒ Boolean

Returns:

  • (Boolean)


626
627
628
# File 'lib/rails/application/configuration.rb', line 626

def respond_to_missing?(symbol, _)
  true
end