Class: Rails::Generator::PathSource
- Defined in:
- lib/rails_generator/lookup.rb
Overview
PathSource looks for generators in a filesystem directory.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes inherited from Source
Instance Method Summary collapse
-
#each ⇒ Object
Yield each eligible subdirectory.
-
#initialize(label, path) ⇒ PathSource
constructor
A new instance of PathSource.
Methods inherited from Source
Constructor Details
#initialize(label, path) ⇒ PathSource
Returns a new instance of PathSource.
170 171 172 173 |
# File 'lib/rails_generator/lookup.rb', line 170 def initialize(label, path) super label @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
168 169 170 |
# File 'lib/rails_generator/lookup.rb', line 168 def path @path end |
Instance Method Details
#each ⇒ Object
Yield each eligible subdirectory.
176 177 178 179 180 181 182 |
# File 'lib/rails_generator/lookup.rb', line 176 def each Dir["#{path}/[a-z]*"].each do |dir| if File.directory?(dir) yield Spec.new(File.basename(dir), dir, label) end end end |