Class: OoxmlParser::ParagraphBorders
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphBorders
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb
Overview
Class for parsing ‘w:pBdr` element
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bar ⇒ BordersProperties
Bar properties.
-
#between ⇒ BordersProperties
Between properties.
-
#bottom ⇒ BordersProperties
Bottom properties.
-
#left ⇒ BordersProperties
Left properties.
-
#right ⇒ BordersProperties
Right properties.
-
#top ⇒ BordersProperties
Top properties.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
- #border_visual_type ⇒ Object
-
#parse(node) ⇒ ParagraphBorders
Parse Paragraph Borders data.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#bar ⇒ BordersProperties
Returns bar properties.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 15 def @bar end |
#between ⇒ BordersProperties
Returns between properties.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 13 def between @between end |
#bottom ⇒ BordersProperties
Returns bottom properties.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 5 def bottom @bottom end |
#left ⇒ BordersProperties
Returns left properties.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 7 def left @left end |
#right ⇒ BordersProperties
Returns right properties.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 11 def right @right end |
#top ⇒ BordersProperties
Returns top properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 9 def top @top end |
Instance Method Details
#border_visual_type ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 17 def border_visual_type result = [] result << :left if @left.val == :single result << :right if @right.val == :single result << :top if @top.val == :single result << :bottom if @bottom.val == :single result << :inner if @between.val == :single return :none if result == [] return :all if result == %i[left right top bottom inner] return :outer if result == %i[left right top bottom] result.first if result.size == 1 end |
#parse(node) ⇒ ParagraphBorders
Parse Paragraph Borders data
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb', line 33 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'bottom' @bottom = BordersProperties.new(parent: self).parse(node_child) when 'left' @left = BordersProperties.new(parent: self).parse(node_child) when 'top' @top = BordersProperties.new(parent: self).parse(node_child) when 'right' @right = BordersProperties.new(parent: self).parse(node_child) when 'between' @between = BordersProperties.new(parent: self).parse(node_child) when 'bar' @bar = BordersProperties.new(parent: self).parse(node_child) end end self end |