Module: Rails::Generator::Lookup

Defined in:
lib/rails_generator/lookup.rb

Overview

Generator lookup is managed by a list of sources which return specs describing where to find and how to create generators. This module provides class methods for manipulating the source list and looking up generator specs, and an #instance wrapper for quickly instantiating generators by name.

A spec is not a generator: it’s a description of where to find the generator and how to create it. A source is anything that yields generators from #each. PathSource and GemSource are provided.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object



51
52
53
54
55
# File 'lib/rails_generator/lookup.rb', line 51

def self.append_features(base)
  super
  base.extend(ClassMethods)
  base.use_component_sources!
end

Instance Method Details

#instance(generator_name, args, runtime_options = {}) ⇒ Object

Convenience method to instantiate another generator.



58
59
60
# File 'lib/rails_generator/lookup.rb', line 58

def instance(generator_name, args, runtime_options = {})
  self.class.instance(generator_name, args, runtime_options)
end