Class: Rails::Configuration::Generators
- Defined in:
- railties/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.
-
#hidden_namespaces ⇒ Object
readonly
Returns the value of attribute hidden_namespaces.
-
#options ⇒ Object
Returns the value of attribute options.
-
#templates ⇒ Object
Returns the value of attribute templates.
Instance Method Summary collapse
- #hide_namespace(namespace) ⇒ Object
-
#initialize ⇒ Generators
constructor
A new instance of Generators.
- #initialize_copy(source) ⇒ Object
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize ⇒ Generators
Returns a new instance of Generators.
48 49 50 51 52 53 54 55 |
# File 'railties/lib/rails/configuration.rb', line 48 def initialize @aliases = Hash.new { |h,k| h[k] = {} } @options = Hash.new { |h,k| h[k] = {} } @fallbacks = {} @templates = [] @colorize_logging = true @hidden_namespaces = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'railties/lib/rails/configuration.rb', line 68 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
45 46 47 |
# File 'railties/lib/rails/configuration.rb', line 45 def aliases @aliases end |
#colorize_logging ⇒ Object
Returns the value of attribute colorize_logging
45 46 47 |
# File 'railties/lib/rails/configuration.rb', line 45 def colorize_logging @colorize_logging end |
#fallbacks ⇒ Object
Returns the value of attribute fallbacks
45 46 47 |
# File 'railties/lib/rails/configuration.rb', line 45 def fallbacks @fallbacks end |
#hidden_namespaces ⇒ Object (readonly)
Returns the value of attribute hidden_namespaces
46 47 48 |
# File 'railties/lib/rails/configuration.rb', line 46 def hidden_namespaces @hidden_namespaces end |
#options ⇒ Object
Returns the value of attribute options
45 46 47 |
# File 'railties/lib/rails/configuration.rb', line 45 def @options end |
#templates ⇒ Object
Returns the value of attribute templates
45 46 47 |
# File 'railties/lib/rails/configuration.rb', line 45 def templates @templates end |
Instance Method Details
#hide_namespace(namespace) ⇒ Object
64 65 66 |
# File 'railties/lib/rails/configuration.rb', line 64 def hide_namespace(namespace) @hidden_namespaces << namespace end |
#initialize_copy(source) ⇒ Object
57 58 59 60 61 62 |
# File 'railties/lib/rails/configuration.rb', line 57 def initialize_copy(source) @aliases = @aliases.deep_dup @options = @options.deep_dup @fallbacks = @fallbacks.deep_dup @templates = @templates.dup end |