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.)
Methods
Attributes
|
[R]
|
name |
|
|
[R]
|
path |
|
|
[R]
|
source |
|
Public Class methods
Source: show
| on GitHub
9: def initialize(name, path, source)
10: @name, @path, @source = name, path, source
11: end
Public Instance methods
Source: show
| on GitHub
24: def class_file
25: "#{path}/#{name}_generator.rb"
26: end
Source: show
| on GitHub
28: def class_name
29: "#{name.camelize}Generator"
30: end
Look up the generator class. Require its class file, find the class in
ObjectSpace, tag it with this spec, and return.
Source: show
| on GitHub
15: def klass
16: unless @klass
17: require class_file
18: @klass = lookup_class
19: @klass.spec = self
20: end
21: @klass
22: end