Module: ToSpreadsheet::Context::Pairing
- Included in:
- ToSpreadsheet::Context
- Defined in:
- lib/to_spreadsheet/context/pairing.rb
Overview
Axlsx classes <-> Nokogiri table nodes round-tripping
Instance Method Summary collapse
- #assoc!(entity, node) ⇒ Object
- #clear_assoc! ⇒ Object
- #to_xls_entity(node) ⇒ Object
- #to_xml_node(entity) ⇒ Object
- #xml_node_and_xls_entity(entity) ⇒ Object
Instance Method Details
#assoc!(entity, node) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/to_spreadsheet/context/pairing.rb', line 5 def assoc!(entity, node) @entity_to_node ||= {} @node_to_entity ||= {} @entity_to_node[entity] = node @node_to_entity[node] = entity end |
#clear_assoc! ⇒ Object
24 25 26 27 |
# File 'lib/to_spreadsheet/context/pairing.rb', line 24 def clear_assoc! @entity_to_node = {} @node_to_entity = {} end |
#to_xls_entity(node) ⇒ Object
12 13 14 |
# File 'lib/to_spreadsheet/context/pairing.rb', line 12 def to_xls_entity(node) @node_to_entity[node] end |
#to_xml_node(entity) ⇒ Object
16 17 18 |
# File 'lib/to_spreadsheet/context/pairing.rb', line 16 def to_xml_node(entity) @entity_to_node[entity] end |
#xml_node_and_xls_entity(entity) ⇒ Object
20 21 22 |
# File 'lib/to_spreadsheet/context/pairing.rb', line 20 def xml_node_and_xls_entity(entity) [@entity_to_node[entity], entity, @node_to_entity[entity]].compact end |