class Uncool::GeneratorAbstract

Generator base class.

Public Class Methods

new(options={}) click to toggle source
# File lib/uncool/generator/abstract.rb, line 8
def initialize(options={})
  @namespaces = options[:namespaces] || []
  @checklist  = options[:checklist]
  @options    = options || {}
end

Public Instance Methods

checklist() click to toggle source
# File lib/uncool/generator/abstract.rb, line 20
def checklist
  @checklist ||= default_checklist
end
covered?() click to toggle source

Include already covered methods.

# File lib/uncool/generator/abstract.rb, line 35
def covered?
  options[:covered]
end
default_checklist() click to toggle source
# File lib/uncool/generator/abstract.rb, line 54
def default_checklist
  list = []
  targets.each do |target|
    target.public_instance_methods(false).each do |meth|
      list << Unit.new(target, meth)
    end
    if private?
      target.protected_instance_methods(false).each do |meth|
        list << Unit.new(target, meth, :access=>:protected)
      end
      target.private_instance_methods(false).each do |meth|
        list << Unit.new(target, meth, :access=>:private)
      end
    end
  end
  list
end
generate() click to toggle source

Override this method in subclasses.

# File lib/uncool/generator/abstract.rb, line 50
def generate
end
mapping() click to toggle source
# File lib/uncool/generator/abstract.rb, line 45
def mapping
  checklist.sort.group_by{ |mp, yes| mp.target }
end
namespaces() click to toggle source
# File lib/uncool/generator/abstract.rb, line 15
def namespaces
  @namespaces
end
options() click to toggle source
# File lib/uncool/generator/abstract.rb, line 30
def options
  @options
end
private?() click to toggle source

Include private and protected methods?

# File lib/uncool/generator/abstract.rb, line 40
def private?
  options[:private]
end
targets() click to toggle source
# File lib/uncool/generator/abstract.rb, line 25
def targets
  @targets ||= namespaces.map{ |ns| eval(ns, TOPLEVEL_BINDING) }
end