Class: Rails::Generator::Source
- Includes:
- Enumerable
- Defined in:
- lib/rails_generator/lookup.rb
Overview
Sources enumerate (yield from #each) generator specs which describe where to find and how to create generators. Enumerable is mixed in so, for example, source.collect will retrieve every generator. Sources may be assigned a label to distinguish them.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#each ⇒ Object
The each method must be implemented in subclasses.
-
#initialize(label) ⇒ Source
constructor
A new instance of Source.
-
#names ⇒ Object
Return a convenient sorted list of all generator names.
Constructor Details
#initialize(label) ⇒ Source
Returns a new instance of Source.
152 153 154 |
# File 'lib/rails_generator/lookup.rb', line 152 def initialize(label) @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
151 152 153 |
# File 'lib/rails_generator/lookup.rb', line 151 def label @label end |
Instance Method Details
#each ⇒ Object
The each method must be implemented in subclasses. The base implementation raises an error.
158 159 160 |
# File 'lib/rails_generator/lookup.rb', line 158 def each raise NotImplementedError end |
#names ⇒ Object
Return a convenient sorted list of all generator names.
163 164 165 |
# File 'lib/rails_generator/lookup.rb', line 163 def names map { |spec| spec.name }.sort end |