class TomParse::TomDoc

Encapsulate parsed tomdoc documentation.

TODO: Currently uses lazy evaluation, eventually this should be removed and simply parsed all at once.

Attributes

raw[RW]

Public Class Methods

new(text, parse_options={}) click to toggle source

Public: Initialize a TomDoc object.

text - The raw text of a method or class/module comment.

Returns new TomDoc instance.

# File lib/tomparse.rb, line 29
def initialize(text, parse_options={})
  @parser = Parser.new(text, parse_options)
  @parser.parse
end
valid?(text) click to toggle source

Validate given comment text.

Returns true if comment is valid, otherwise false.

# File lib/tomparse.rb, line 44
def self.valid?(text)
  new(text).valid?
end

Public Instance Methods

args()
Alias for: arguments
arguments() click to toggle source

Arguments list.

Returns list of arguments.

# File lib/tomparse.rb, line 89
def arguments
  @parser.arguments
end
Also aliased as: args
deprecated?() click to toggle source

Check if method is deprecated.

Returns true if method is deprecated.

# File lib/tomparse.rb, line 171
def deprecated?
  @parser.deprecated?
end
description() click to toggle source

Description of method or class/module.

Returns description String.

# File lib/tomparse.rb, line 82
def description
  @parser.description
end
examples() click to toggle source

List of use examples of a method or class/module.

Returns String of examples.

# File lib/tomparse.rb, line 105
def examples
  @parser.examples
end
internal?() click to toggle source

Check if method is internal.

Returns true if method is internal.

# File lib/tomparse.rb, line 164
def internal?
  @parser.internal?
end
keyword_arguments()
Alias for: options
options() click to toggle source

Keyword arguments, aka Options.

Returns list of options.

# File lib/tomparse.rb, line 97
def options
  @parser.options
end
Also aliased as: keyword_arguments
public?() click to toggle source

Check if method is public.

Returns true if method is public.

# File lib/tomparse.rb, line 157
def public?
  @parser.public?
end
raises() click to toggle source

A list of errors a method might raise.

Returns Array of method raises descriptions.

# File lib/tomparse.rb, line 126
def raises
  @parser.raises
end
returns() click to toggle source

The list of retrun values a method can return.

Returns Array of method return descriptions.

# File lib/tomparse.rb, line 119
def returns
  @parser.returns
end
sections() click to toggle source

List of comment sections. These are divided simply on “nn”.

Returns Array of comment sections.

# File lib/tomparse.rb, line 75
def sections
  @parser.sections
end
signature_fields() click to toggle source

Deprecated: A list of signature fields.

TODO: Presently this will always return an empty list. It will either be removed or renamed in future version.

Returns Array of field definitions.

# File lib/tomparse.rb, line 143
def signature_fields
  @parser.signature_fields
end
signatures() click to toggle source

A list of alternate method signatures.

Returns Array of signatures.

# File lib/tomparse.rb, line 133
def signatures
  @parser.signatures 
end
tags() click to toggle source

List of tags.

Returns an associatve array of tags. [Array<Array<String>>]

# File lib/tomparse.rb, line 150
def tags
  @parser.tags
end
to_s() click to toggle source

Raw documentation text.

Returns String of raw documentation text.

# File lib/tomparse.rb, line 37
def to_s
  @parser.raw
end
tomdoc() click to toggle source

The raw comment text cleaned-up and ready for section parsing.

Returns cleaned-up comment String.

# File lib/tomparse.rb, line 68
def tomdoc
  return @parser.tomdoc
end
valid?() click to toggle source

Validate raw comment.

Returns true if comment is valid, otherwise false.

# File lib/tomparse.rb, line 51
def valid?
  @parser.valid?
end
validate() click to toggle source

Validate raw comment.

Returns true if comment is valid. Raises ParseError if comment is not valid.

# File lib/tomparse.rb, line 59
def validate
  @parser.validate
end
yields() click to toggle source

Description of a methods yield procedure.

Returns String decription of yield procedure.

# File lib/tomparse.rb, line 112
def yields
  @parser.yields
end