Class: OoxmlParser::ParagraphBorders
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphBorders
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_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 ⇒ Symbol
Type of border in visual editor.
-
#parse(node) ⇒ ParagraphBorders
Parse Paragraph Borders data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#bar ⇒ BordersProperties
Returns bar properties.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 17 def @bar end |
#between ⇒ BordersProperties
Returns between properties.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 15 def between @between end |
#bottom ⇒ BordersProperties
Returns bottom properties.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 7 def bottom @bottom end |
#left ⇒ BordersProperties
Returns left properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 9 def left @left end |
#right ⇒ BordersProperties
Returns right properties.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 13 def right @right end |
#top ⇒ BordersProperties
Returns top properties.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 11 def top @top end |
Instance Method Details
#border_visual_type ⇒ Symbol
Returns type of border in visual editor.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 20 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
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_borders.rb', line 37 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 |