Extended maintenance of Ruby versions 1.8.7 and 1.9.2 will end on July 31, 2014. Read more

In Files

  • rdoc/markup/simple_markup/fragments.rb

Files

Class/Module Index [+]

Quicksearch

SM::Fragment

A Fragment is a chunk of text, subclassed as a paragraph, a list entry, or verbatim text

Constants

TYPE_MAP

This is a simple factory system that lets us associate fragement types (a string) with a subclass of fragment

Attributes

level[R]
param[R]
txt[R]
type[RW]

Public Class Methods

for(line) click to toggle source
 
               # File rdoc/markup/simple_markup/fragments.rb, line 41
def Fragment.for(line)
  klass =  TYPE_MAP[line.type] ||
    raise("Unknown line type: '#{line.type.inspect}:' '#{line.text}'")
  return klass.new(line.level, line.param, line.flag, line.text)
end
            
new(level, param, type, txt) click to toggle source
 
               # File rdoc/markup/simple_markup/fragments.rb, line 14
def initialize(level, param, type, txt)
  @level = level
  @param = param
  @type  = type
  @txt   = ""
  add_text(txt) if txt
end
            
type_name(name) click to toggle source
 
               # File rdoc/markup/simple_markup/fragments.rb, line 37
def Fragment.type_name(name)
  TYPE_MAP[name] = self
end
            

Public Instance Methods

add_text(txt) click to toggle source
 
               # File rdoc/markup/simple_markup/fragments.rb, line 22
def add_text(txt)
  @txt << " " if @txt.length > 0
  @txt << txt.tr_s("\n ", "  ").strip
end
            
to_s() click to toggle source
 
               # File rdoc/markup/simple_markup/fragments.rb, line 27
def to_s
  "L#@level: #{self.class.name.split('::')[-1]}\n#@txt"
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus