Class: ODFWriter::TableReader
- Inherits:
-
Object
- Object
- ODFWriter::TableReader
- Defined in:
- lib/odf_writer/table_reader.rb
Overview
TableReader: find all tables and set name
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(opts) ⇒ TableReader
constructor
initialize.
-
#nodes(doc) ⇒ Object
nodes.
-
#tables(doc) ⇒ Object
tables.
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
#name ⇒ Object
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 |