Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/rails_generator/lookup.rb
Class Method Summary collapse
-
.lookup_missing_generator(class_id) ⇒ Object
Lookup missing generators using const_missing.
Class Method Details
.lookup_missing_generator(class_id) ⇒ Object
Lookup missing generators using const_missing. This allows any generator to reference another without having to know its location: RubyGems, ~/.rails/generators, and RAILS_ROOT/generators.
8 9 10 11 12 13 14 15 |
# File 'lib/rails_generator/lookup.rb', line 8 def lookup_missing_generator(class_id) if md = /(.+)Generator$/.match(class_id.to_s) name = md.captures.first.demodulize.underscore Rails::Generator::Base.lookup(name).klass else const_missing_before_generators(class_id) end end |