class HTOTConv::Parser::Mspdi::ListDoc

Public Class Methods

new(outline) click to toggle source
# File lib/htot_conv/parser/mspdi.rb, line 34
def initialize(outline)
  @outline = outline
  @breadcrumb = []
end

Public Instance Methods

cdata_block(string)
Alias for: characters
characters(string) click to toggle source
# File lib/htot_conv/parser/mspdi.rb, line 49
def characters(string)
  if @breadcrumb.include?('Task')
    type = @breadcrumb.last
    @values[type] = ''.dup unless @values.include?(type)
    @values[type] << string
  end
end
Also aliased as: cdata_block
end_element(name) click to toggle source
# File lib/htot_conv/parser/mspdi.rb, line 44
def end_element(name)
  @breadcrumb.pop
  generate_outline_item if name == 'Task'
end
start_element(name, attrs=[]) click to toggle source
# File lib/htot_conv/parser/mspdi.rb, line 39
def start_element(name, attrs=[])
  @breadcrumb << name
  @values = {} if name == 'Task'
end

Private Instance Methods

generate_outline_item() click to toggle source
# File lib/htot_conv/parser/mspdi.rb, line 60
def generate_outline_item
  text = ""
  level = 1
  values = []
  @values.each do |pair|
    attr_name, attr_val = pair
    if attr_name == "Name"
      text = attr_val
    elsif attr_name == "OutlineLevel"
      level = attr_val.to_i
    else
      if @outline.value_header.include?(attr_name)
        values[@outline.value_header.index(attr_name)] = attr_val
      end
    end
  end

  @outline.add_item(text, level, values)
end