Class: RubiGen::Spec

### Home Classes Methods

### In Files

- lib/rubigen/spec.rb

### Parent

Object

### Methods

- ::new
- #class_file
- #class_name
- #klass
- #usage_file
- #visible?

### Files

- History.txt
- License.txt
- Manifest.txt
- Todo.txt
- README.txt
- index.txt
- version-raw.txt
- version.txt

### Class/Module Index

Quicksearch

- RubiGen
- RubiGen::AbstractGemSource
- RubiGen::Base
- RubiGen::Commands
- RubiGen::Commands::Base
- RubiGen::Commands::Create
- RubiGen::Commands::Destroy
- RubiGen::Commands::List
- RubiGen::Commands::RewindBase
- RubiGen::Commands::Update
- RubiGen::GemPathSource
- RubiGen::GeneratedAttribute
- RubiGen::GeneratorError
- RubiGen::GeneratorTestHelper
- RubiGen::Lookup
- RubiGen::Lookup::ClassMethods
- RubiGen::Manifest
- RubiGen::Options
- RubiGen::Options::ClassMethods
- RubiGen::PathFilteredSource
- RubiGen::PathSource
- RubiGen::Scripts
- RubiGen::Scripts::Base
- RubiGen::Scripts::Destroy
- RubiGen::Scripts::Generate
- RubiGen::Scripts::Update
- RubiGen::Source
- RubiGen::Spec
- RubiGen::UsageError
- Rubigen
- Rubigen::CLI
- Dir
- Object

No matching classes.

# RubiGen::Spec

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.)

### Attributes

name[R]
path[R]
source[R]

### Public Class Methods

new(name, path, source) click to toggle source

    # File lib/rubigen/spec.rb, line 8
    def initialize(name, path, source)
      @name, @path, @source, @klass = name, path, source, nil
    end

### Public Instance Methods

class_file() click to toggle source

    # File lib/rubigen/spec.rb, line 23
    def class_file
      "#{path}/#{name}_generator.rb"
    end

class_name() click to toggle source

    # File lib/rubigen/spec.rb, line 27
    def class_name
      "#{name.camelize}Generator"
    end

klass() click to toggle source

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

usage_file() click to toggle source

    # File lib/rubigen/spec.rb, line 31
    def usage_file
      "#{path}/USAGE"
    end

visible?() click to toggle source

    # File lib/rubigen/spec.rb, line 35
    def visible?
      File.exists? usage_file
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.