A spec knows where a generator was found and how to instantiate it. Metadata include the generator’s name, its base path, and the source which yielded it (PathSource, GemPathSource, etc.)
# File lib/rubigen/spec.rb, line 23 def class_file "#{path}/#{name}_generator.rb" end
# File lib/rubigen/spec.rb, line 27 def class_name "#{name.camelize}Generator" end
Look up the generator class. Require its class file, find the class in ObjectSpace, tag it with this spec, and return.
# File lib/rubigen/spec.rb, line 14 def klass unless @klass require class_file @klass = lookup_class @klass.spec = self end @klass end
Generated with the Darkfish Rdoc Generator 2.