Class: Rails::Configuration::Generators
- Inherits:
-
Object
- Object
- Rails::Configuration::Generators
- Defined in:
- lib/rails/configuration.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#colorize_logging ⇒ Object
Returns the value of attribute colorize_logging.
-
#fallbacks ⇒ Object
Returns the value of attribute fallbacks.
-
#options ⇒ Object
Returns the value of attribute options.
-
#templates ⇒ Object
Returns the value of attribute templates.
Instance Method Summary collapse
-
#initialize ⇒ Generators
constructor
A new instance of Generators.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize ⇒ Generators
Returns a new instance of Generators.
46 47 48 49 50 51 52 |
# File 'lib/rails/configuration.rb', line 46 def initialize @aliases = Hash.new { |h,k| h[k] = {} } @options = Hash.new { |h,k| h[k] = {} } @fallbacks = {} @templates = [] @colorize_logging = true end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rails/configuration.rb', line 54 def method_missing(method, *args) method = method.to_s.sub(/=$/, '').to_sym return @options[method] if args.empty? if method == :rails || args.first.is_a?(Hash) namespace, configuration = method, args.shift else namespace, configuration = args.shift, args.shift namespace = namespace.to_sym if namespace.respond_to?(:to_sym) @options[:rails][method] = namespace end if configuration aliases = configuration.delete(:aliases) @aliases[namespace].merge!(aliases) if aliases @options[namespace].merge!(configuration) end end |
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
44 45 46 |
# File 'lib/rails/configuration.rb', line 44 def aliases @aliases end |
#colorize_logging ⇒ Object
Returns the value of attribute colorize_logging.
44 45 46 |
# File 'lib/rails/configuration.rb', line 44 def colorize_logging @colorize_logging end |
#fallbacks ⇒ Object
Returns the value of attribute fallbacks.
44 45 46 |
# File 'lib/rails/configuration.rb', line 44 def fallbacks @fallbacks end |
#options ⇒ Object
Returns the value of attribute options.
44 45 46 |
# File 'lib/rails/configuration.rb', line 44 def @options end |
#templates ⇒ Object
Returns the value of attribute templates.
44 45 46 |
# File 'lib/rails/configuration.rb', line 44 def templates @templates end |