Class: Rails::Configuration::Generators
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | railties/lib/rails/configuration.rb |
Class Method Summary
- .new ⇒ Generators constructor
Instance Attribute Summary
- #after_generate_callbacks readonly
- #aliases rw
- #api_only rw
- #colorize_logging rw
- #fallbacks rw
- #hidden_namespaces readonly
- #options rw
- #templates rw
Instance Method Summary
Constructor Details
.new ⇒ Generators
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 143
def method_missing(method, *args) method = method.name.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 (readonly)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 106
attr_reader :hidden_namespaces, :after_generate_callbacks
#aliases (rw)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 105
attr_accessor :aliases, :, :templates, :fallbacks, :colorize_logging, :api_only
#api_only (rw)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 105
attr_accessor :aliases, :, :templates, :fallbacks, :colorize_logging, :api_only
#colorize_logging (rw)
[ GitHub ]#fallbacks (rw)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 105
attr_accessor :aliases, :, :templates, :fallbacks, :colorize_logging, :api_only
#options (rw)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 105
attr_accessor :aliases, :, :templates, :fallbacks, :colorize_logging, :api_only
#templates (rw)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 105
attr_accessor :aliases, :, :templates, :fallbacks, :colorize_logging, :api_only
Instance Method Details
#after_generate(&block)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 130
def after_generate(&block) @after_generate_callbacks << block end
#apply_rubocop_autocorrect_after_generate!
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 134
def apply_rubocop_autocorrect_after_generate! after_generate do |files| parsable_files = files.filter { |file| File.exist?(file) && file.end_with?(".rb") } unless parsable_files.empty? system(RbConfig.ruby, "bin/rubocop", "-A", "--fail-level=E", "--format=quiet", *parsable_files, exception: true) end end end
#hide_namespace(namespace)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 126
def hide_namespace(namespace) @hidden_namespaces << namespace end
#initialize_copy(source)
[ GitHub ]# File 'railties/lib/rails/configuration.rb', line 119
def initialize_copy(source) @aliases = @aliases.deep_dup @options = @options.deep_dup @fallbacks = @fallbacks.deep_dup @templates = @templates.dup end