Class: RTF::ListTable
- Inherits:
-
Object
- Object
- RTF::ListTable
- Defined in:
- lib/rtf/list.rb
Instance Method Summary collapse
-
#initialize ⇒ ListTable
constructor
A new instance of ListTable.
- #new_template ⇒ Object
- #to_rtf(indent = 0) ⇒ Object
Constructor Details
#initialize ⇒ ListTable
Returns a new instance of ListTable.
3 4 5 |
# File 'lib/rtf/list.rb', line 3 def initialize @templates = [] end |
Instance Method Details
#new_template ⇒ Object
7 8 9 10 |
# File 'lib/rtf/list.rb', line 7 def new_template @templates.push ListTemplate.new(next_template_id) @templates.last end |
#to_rtf(indent = 0) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rtf/list.rb', line 12 def to_rtf(indent=0) return '' if @templates.empty? prefix = indent > 0 ? ' ' * indent : '' # List table text = "#{prefix}{\\*\\listtable" @templates.each {|tpl| text << tpl.to_rtf} text << "}" # List override table, a Cargo Cult. text << "#{prefix}{\\*\\listoverridetable" @templates.each do |tpl| text << "{\\listoverride\\listid#{tpl.id}\\listoverridecount0\\ls#{tpl.id}}" end text << "}\n" end |