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, GemSource, etc.)
Methods
- C
- K
- N
Attributes
[R] | name | |
[R] | path | |
[R] | source |
Class Public methods
Source: show
# File rails/railties/lib/rails_generator/spec.rb, line 9 def initialize(name, path, source) @name, @path, @source = name, path, source end
Instance Public methods
Source: show
# File rails/railties/lib/rails_generator/spec.rb, line 24 def class_file "#{path}/#{name}_generator.rb" end
Source: show
# File rails/railties/lib/rails_generator/spec.rb, line 28 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.
Source: show
# File rails/railties/lib/rails_generator/spec.rb, line 15 def klass unless @klass require class_file @klass = lookup_class @klass.spec = self end @klass end