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.
# File lib/rubigen/lookup.rb, line 191 def initialize(label) @label = label end
The each method must be implemented in subclasses. The base implementation raises an error.
# File lib/rubigen/lookup.rb, line 197 def each raise NotImplementedError end
Return a convenient sorted list of all generator names.
# File lib/rubigen/lookup.rb, line 202 def names(filter = nil) inject([]) do |mem, spec| case filter when :visible mem << spec.name if spec.visible? end mem end.sort end