class DataMetaDom::Doc
Documentation tag
For command line details either check the new method's source or the README.rdoc file, the usage section.
Attributes
target[R]
Documentation target such as PLAIN_DOC_TARGET or JAVA_DOC_TARGET or whatever is added in the future. May stick with plaintext unless it becomes easy to write in a common markup format and generate specific doc format from it.
Can be one of the following:
-
PLAIN_DOC_TARGET -
plain
-
JAVA_DOC_TARGET -
java
text[RW]
The text of the documentation.
Public Class Methods
new(target, text)
click to toggle source
Creates an instance for the given target and given text.
# File lib/dataMetaDom/docs.rb, line 41 def initialize(target, text) @target = target.to_sym #noinspection RubyArgCount raise "Unsupported docs target #@target" unless DOC_TARGETS.member?(@target) @text = text end
parse(source, params)
click to toggle source
Parses the documentation from the given source, returns an instance of Doc
.
-
Parameters:
-
source
- an instance ofSourceFile
-
params
- an array, first member is the target.
-
# File lib/dataMetaDom/docs.rb, line 55 def self.parse(source, params) text = '' while (line = source.nextLine(true)) case line when /^\s*#{END_KW}\s*$/ retVal = Doc.new params[0], text return retVal else text << line end # case end # while line raise "Parsing a doc: missing end keyword, source=#{source}" end
Public Instance Methods
to_s()
click to toggle source
Textual for the instance
# File lib/dataMetaDom/docs.rb, line 70 def to_s; "Doc-#{target}\n#{text}" end