Class | SM::Fragment |
In: |
rdoc/markup/simple_markup/fragments.rb
|
Parent: | Object |
A Fragment is a chunk of text, subclassed as a paragraph, a list entry, or verbatim text
TYPE_MAP | = | {} | This is a simple factory system that lets us associate fragement types (a string) with a subclass of fragment |
level | [R] | |
param | [R] | |
txt | [R] | |
type | [RW] |
# 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
# 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
# File rdoc/markup/simple_markup/fragments.rb, line 37 def Fragment.type_name(name) TYPE_MAP[name] = self end