class CabbageDoc::Generator
Constants
- PRIORITIES
Attributes
tag[RW]
Public Class Methods
all()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 31 def all @_all ||= {} end
exists?(type)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 39 def exists?(type) all.has_key?(type) end
find(type)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 51 def find(type) klass = all[type] raise InvalidType, type unless klass klass end
inherited(klass)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 10 def inherited(klass) all[klass.to_s.split('::').last.downcase.to_sym] = klass end
load!()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 59 def load! Dir.glob(File.join(File.dirname(__FILE__), 'generators', '*.rb')).sort.each do |generator| require(generator) end end
new(tag = nil)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 68 def initialize(tag = nil) self.tag = tag end
perform(type, tag = nil)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 43 def perform(type, tag = nil) if type == :all all.map { |_, klass| klass.new(tag).perform } else find(type).new(tag).perform end end
priority(value = nil)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 22 def priority(value = nil) if value.is_a?(Symbol) raise InvalidPriority, value unless PRIORITIES.include?(value) @_priority = value else @_priority end end
supports?(type, what)
click to toggle source
# File lib/cabbage_doc/generator.rb, line 35 def supports?(type, what) !!find(type).public_send(what) end
Public Instance Methods
perform()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 72 def perform raise NotImplementedError end
Protected Instance Methods
collection()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 78 def collection @_collection ||= Collection.instance.tap do |collection| collection.load! end end
config()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 88 def config @_config ||= Configuration.instance end
controllers()
click to toggle source
# File lib/cabbage_doc/generator.rb, line 84 def controllers @_controllers ||= config.controllers.call end