Class: OoxmlParser::Box

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb

Overview

Class for ‘box`, `borderBox` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Box

Returns a new instance of Box.



6
7
8
9
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb', line 6

def initialize(parent: nil)
  @borders = false
  @parent = parent
end

Instance Attribute Details

#bordersObject

Returns the value of attribute borders.



4
5
6
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb', line 4

def borders
  @borders
end

#elementObject

Returns the value of attribute element.



4
5
6
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb', line 4

def element
  @element
end

Instance Method Details

#parse(node) ⇒ Box

Parse Box object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:

  • (Box)

    result of parsing



14
15
16
17
18
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb', line 14

def parse(node)
  @borders = true if node.name == 'borderBox'
  @element = MathRun.new(parent: self).parse(node)
  self
end