Class: OoxmlParser::Borders
- Inherits:
-
ParagraphBorders
- Object
- OOXMLDocumentObject
- ParagraphBorders
- OoxmlParser::Borders
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb
Overview
Borders data
Instance Attribute Summary collapse
-
#bar ⇒ Object
Returns the value of attribute bar.
-
#between ⇒ Object
Returns the value of attribute between.
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#display ⇒ Object
Returns the value of attribute display.
-
#inner_horizontal ⇒ Object
Returns the value of attribute inner_horizontal.
-
#inner_vertical ⇒ Object
Returns the value of attribute inner_vertical.
-
#left ⇒ Object
Returns the value of attribute left.
-
#offset_from ⇒ Object
Returns the value of attribute offset_from.
-
#right ⇒ Object
Returns the value of attribute right.
-
#top ⇒ Object
Returns the value of attribute top.
-
#top_left_to_bottom_right ⇒ Object
Returns the value of attribute top_left_to_bottom_right.
-
#top_right_to_bottom_left ⇒ Object
Returns the value of attribute top_right_to_bottom_left.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#==(other) ⇒ True, False
Compare this object to other.
-
#copy ⇒ Borders
Method to copy object.
- #each_border {|bottom| ... } ⇒ Object
- #each_side {|bottom| ... } ⇒ Object
-
#initialize(parent: nil) ⇒ Borders
constructor
A new instance of Borders.
-
#parse(node) ⇒ Borders
Parse Borders object.
-
#to_s ⇒ String
Result of convert of object to string.
- #visible? ⇒ Boolean
Methods inherited from ParagraphBorders
Methods inherited from OOXMLDocumentObject
#boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ Borders
Returns a new instance of Borders.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 10 def initialize(parent: nil) @left = BordersProperties.new @right = BordersProperties.new @top = BordersProperties.new @bottom = BordersProperties.new @between = BordersProperties.new @inner_horizontal = BordersProperties.new @inner_vertical = BordersProperties.new super end |
Instance Attribute Details
#bar ⇒ Object
Returns the value of attribute bar.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def @bar end |
#between ⇒ Object
Returns the value of attribute between.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def between @between end |
#bottom ⇒ Object
Returns the value of attribute bottom.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def bottom @bottom end |
#display ⇒ Object
Returns the value of attribute display.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def display @display end |
#inner_horizontal ⇒ Object
Returns the value of attribute inner_horizontal.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def inner_horizontal @inner_horizontal end |
#inner_vertical ⇒ Object
Returns the value of attribute inner_vertical.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def inner_vertical @inner_vertical end |
#left ⇒ Object
Returns the value of attribute left.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def left @left end |
#offset_from ⇒ Object
Returns the value of attribute offset_from.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def offset_from @offset_from end |
#right ⇒ Object
Returns the value of attribute right.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def right @right end |
#top ⇒ Object
Returns the value of attribute top.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def top @top end |
#top_left_to_bottom_right ⇒ Object
Returns the value of attribute top_left_to_bottom_right.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def top_left_to_bottom_right @top_left_to_bottom_right end |
#top_right_to_bottom_left ⇒ Object
Returns the value of attribute top_right_to_bottom_left.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 7 def top_right_to_bottom_left @top_right_to_bottom_left end |
Instance Method Details
#==(other) ⇒ True, False
Compare this object to other
40 41 42 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 40 def ==(other) @left == other.left && @right == other.right && @top == other.top && @bottom == other.bottom if other.is_a?(Borders) end |
#copy ⇒ Borders
Method to copy object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 23 def copy new_borders = Borders.new new_borders.left = @left if @left new_borders.right = @right if @right new_borders.top = @top if @top new_borders.bottom = @bottom if @bottom new_borders.inner_vertical = @inner_vertical if @inner_vertical new_borders.inner_horizontal = @inner_horizontal if @inner_horizontal new_borders.between = @between if @between new_borders.display = @display if @display new_borders. = @bar if @bar new_borders end |
#each_border {|bottom| ... } ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 44 def each_border yield(bottom) yield(inner_horizontal) yield(inner_vertical) yield(left) yield(right) yield(top) end |
#each_side {|bottom| ... } ⇒ Object
53 54 55 56 57 58 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 53 def each_side yield(bottom) yield(left) yield(right) yield(top) end |
#parse(node) ⇒ Borders
Parse Borders object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 76 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'lnL', 'left' @left = TableCellLine.new(parent: self).parse(node_child) when 'lnR', 'right' @right = TableCellLine.new(parent: self).parse(node_child) when 'lnT', 'top' @top = TableCellLine.new(parent: self).parse(node_child) when 'lnB', 'bottom' @bottom = TableCellLine.new(parent: self).parse(node_child) when 'insideV' @inner_vertical = TableCellLine.new(parent: self).parse(node_child) when 'insideH' @inner_horizontal = TableCellLine.new(parent: self).parse(node_child) end end self end |
#to_s ⇒ String
Returns result of convert of object to string.
61 62 63 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 61 def to_s "Left border: #{left}, Right: #{right}, Top: #{top}, Bottom: #{bottom}" end |
#visible? ⇒ Boolean
65 66 67 68 69 70 71 |
# File 'lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb', line 65 def visible? visible = false each_side do |current_size| visible ||= current_size.visible? end visible end |