class Rails::Configuration::Generators
:nodoc:
def after_generate(&block)
def after_generate(&block) @after_generate_callbacks << block end
def hide_namespace(namespace)
def hide_namespace(namespace) @hidden_namespaces << namespace end
def initialize
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
def initialize_copy(source)
def initialize_copy(source) @aliases = @aliases.deep_dup @options = @options.deep_dup @fallbacks = @fallbacks.deep_dup @templates = @templates.dup end
def method_missing(method, *args)
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