Class: OoxmlParser::Box

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/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

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Box

Returns a new instance of Box.



8
9
10
11
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/box.rb', line 8

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

Instance Attribute Details

#bordersObject

Returns the value of attribute borders.



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

def borders
  @borders
end

#elementObject

Returns the value of attribute element.



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

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



16
17
18
19
20
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/box.rb', line 16

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