Class: Raf::NumList

Inherits:
Element show all
Defined in:
lib/rafelement.rb

Instance Attribute Summary

Attributes inherited from Element

#contents

Instance Method Summary collapse

Methods inherited from Element

#add=, #initialize

Constructor Details

This class inherits a constructor from Raf::Element

Instance Method Details

#applyObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/rafelement.rb', line 102

def apply
  str = "<NumList>"
  num = 1
  @contents.map  do |c|
    if c == :INDENT
      str += "<INDENT/>"
    elsif c == :DEDENT
      str +="<DEDENT/>"
    else
      str += "<NumListItem>#{num}. #{c.apply}</NumListItem>"
      num += 1
    end
  end
  str += "</NumList>"
  str
end