Class: Rails::Configuration::Generators

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/configuration.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGenerators

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

#aliasesObject

Returns the value of attribute aliases


44
45
46
# File 'lib/rails/configuration.rb', line 44

def aliases
  @aliases
end

#colorize_loggingObject

Returns the value of attribute colorize_logging


44
45
46
# File 'lib/rails/configuration.rb', line 44

def colorize_logging
  @colorize_logging
end

#fallbacksObject

Returns the value of attribute fallbacks


44
45
46
# File 'lib/rails/configuration.rb', line 44

def fallbacks
  @fallbacks
end

#optionsObject

Returns the value of attribute options


44
45
46
# File 'lib/rails/configuration.rb', line 44

def options
  @options
end

#templatesObject

Returns the value of attribute templates


44
45
46
# File 'lib/rails/configuration.rb', line 44

def templates
  @templates
end