Class: Rails::Configuration::Generators
- Inherits:
-
Object
- Object
- Rails::Configuration::Generators
- Defined in:
- lib/rails/configuration.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#after_generate_callbacks ⇒ Object
readonly
Returns the value of attribute after_generate_callbacks.
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#api_only ⇒ Object
Returns the value of attribute api_only.
-
#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
- #after_generate(&block) ⇒ Object
- #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.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/rails/configuration.rb', line 113 def initialize @aliases = Hash.new { |h, k| h[k] = {} } @options = Hash.new { |h, k| h[k] = {} } @fallbacks = {} @templates = [] @colorize_logging = true @api_only = false @hidden_namespaces = [] @after_generate_callbacks = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/rails/configuration.rb', line 139 def method_missing(method, *args) method = method.to_s.delete_suffix("=").to_sym if args.empty? if method == :rails return @options[method] else return @options[:rails][method] end end 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
#after_generate_callbacks ⇒ Object (readonly)
Returns the value of attribute after_generate_callbacks.
111 112 113 |
# File 'lib/rails/configuration.rb', line 111 def after_generate_callbacks @after_generate_callbacks end |
#aliases ⇒ Object
Returns the value of attribute aliases.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def aliases @aliases end |
#api_only ⇒ Object
Returns the value of attribute api_only.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def api_only @api_only end |
#colorize_logging ⇒ Object
Returns the value of attribute colorize_logging.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def colorize_logging @colorize_logging end |
#fallbacks ⇒ Object
Returns the value of attribute fallbacks.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def fallbacks @fallbacks end |
#hidden_namespaces ⇒ Object (readonly)
Returns the value of attribute hidden_namespaces.
111 112 113 |
# File 'lib/rails/configuration.rb', line 111 def hidden_namespaces @hidden_namespaces end |
#options ⇒ Object
Returns the value of attribute options.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def @options end |
#templates ⇒ Object
Returns the value of attribute templates.
110 111 112 |
# File 'lib/rails/configuration.rb', line 110 def templates @templates end |
Instance Method Details
#after_generate(&block) ⇒ Object
135 136 137 |
# File 'lib/rails/configuration.rb', line 135 def after_generate(&block) @after_generate_callbacks << block end |
#hide_namespace(namespace) ⇒ Object
131 132 133 |
# File 'lib/rails/configuration.rb', line 131 def hide_namespace(namespace) @hidden_namespaces << namespace end |
#initialize_copy(source) ⇒ Object
124 125 126 127 128 129 |
# File 'lib/rails/configuration.rb', line 124 def initialize_copy(source) @aliases = @aliases.deep_dup @options = @options.deep_dup @fallbacks = @fallbacks.deep_dup @templates = @templates.dup end |