class SchemaRD::RDocParser

Public Class Methods

new(filename) click to toggle source
# File lib/schemard/rdoc_parser.rb, line 4
def initialize(filename)
  parse(filename)
end

Public Instance Methods

table_comment(name) click to toggle source
# File lib/schemard/rdoc_parser.rb, line 8
def table_comment(name)
  method_obj = @clazz.find_method_named(name)
  method_obj ? method_obj.comment.text : ""
end

Private Instance Methods

parse(filename) click to toggle source
# File lib/schemard/rdoc_parser.rb, line 15
def parse(filename)
  file_content = File.read(filename)
  content = "module Schemafile\n#{file_content}\nend"

  rdoc = RDoc::RDoc.new
  store = RDoc::Store.new
  options = rdoc.load_options
  stats = RDoc::Stats.new(store, 1, options.verbosity)
  top_level = store.add_file(filename)
  RDoc::Parser::Ruby.new(top_level, filename, content, options, stats).scan
  @clazz = top_level.find_module_named("Schemafile")
end