Class: ODFWriter::SectionReader

Inherits:
Object
  • Object
show all
Defined in:
lib/odf_writer/section_reader.rb

Overview

SectionReader: find all sections and set name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ SectionReader

initialize



38
39
40
# File 'lib/odf_writer/section_reader.rb', line 38

def initialize(opts)
  @name = opts[:name]
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



31
32
33
# File 'lib/odf_writer/section_reader.rb', line 31

def name
  @name
end

Instance Method Details

#nodes(doc) ⇒ Object

nodes



56
57
58
# File 'lib/odf_writer/section_reader.rb', line 56

def nodes( doc )
  doc.xpath(".//text:section").map{|node| [node.attr("text:name"), node] }.to_h
end

#sections(doc) ⇒ Object

sections



47
48
49
# File 'lib/odf_writer/section_reader.rb', line 47

def sections( doc )
  nodes( doc ).keys
end