Class: RubiGen::GemPathSource

Inherits:
AbstractGemSource show all
Defined in:
lib/rubigen/lookup.rb

Overview

GemPathSource looks for generators within any RubyGem’s /filter_generators/**/<generator_name>_generator.rb file.

Instance Attribute Summary collapse

Attributes inherited from Source

#label

Instance Method Summary collapse

Methods inherited from Source

#names

Constructor Details

#initialize(*filters) ⇒ GemPathSource

Returns a new instance of GemPathSource.



265
266
267
268
# File 'lib/rubigen/lookup.rb', line 265

def initialize(*filters)
  super()
  @filters = filters
end

Instance Attribute Details

#filtersObject

Returns the value of attribute filters.



263
264
265
# File 'lib/rubigen/lookup.rb', line 263

def filters
  @filters
end

Instance Method Details

#==(source) ⇒ Object



277
278
279
# File 'lib/rubigen/lookup.rb', line 277

def ==(source)
  self.class == source.class && filters == source.filters
end

#eachObject

Yield each generator within rails_generator subdirectories.



271
272
273
274
275
# File 'lib/rubigen/lookup.rb', line 271

def each
  generator_full_paths.each do |generator|
    yield Spec.new(File.basename(generator).sub(/_generator.rb$/, ''), File.dirname(generator), label)
  end
end