Class: ODFWriter::TableReader

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

Overview

TableReader: find all tables and set name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ TableReader

initialize



38
39
40
# File 'lib/odf_writer/table_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/table_reader.rb', line 31

def name
  @name
end

Instance Method Details

#nodes(doc) ⇒ Object

nodes



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

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

#tables(doc) ⇒ Object

tables



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

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