Class: OoxmlParser::BordersProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::BordersProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/borders_properties.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#frame ⇒ Object
Returns the value of attribute frame.
-
#shadow ⇒ Object
Returns the value of attribute shadow.
-
#side ⇒ Object
Returns the value of attribute side.
-
#space ⇒ Object
Returns the value of attribute space.
-
#sz ⇒ Object
(also: #size)
Returns the value of attribute sz.
-
#val ⇒ Object
Returns the value of attribute val.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
- #copy ⇒ Object
-
#initialize(color = :auto, sz = 0, val = :none, space = 0, parent: nil) ⇒ BordersProperties
constructor
A new instance of BordersProperties.
- #nil? ⇒ Boolean
-
#parse(node) ⇒ BordersProperties
Parse BordersProperties.
- #to_s ⇒ Object
- #visible? ⇒ Boolean
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
Constructor Details
#initialize(color = :auto, sz = 0, val = :none, space = 0, parent: nil) ⇒ BordersProperties
Returns a new instance of BordersProperties.
6 7 8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def initialize(color = :auto, sz = 0, val = :none, space = 0, parent: nil) @color = color @sz = sz @val = val @space = space @parent = parent end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def color @color end |
#frame ⇒ Object
Returns the value of attribute frame.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def frame @frame end |
#shadow ⇒ Object
Returns the value of attribute shadow.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def shadow @shadow end |
#side ⇒ Object
Returns the value of attribute side.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def side @side end |
#space ⇒ Object
Returns the value of attribute space.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def space @space end |
#sz ⇒ Object Also known as: size
Returns the value of attribute sz.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def sz @sz end |
#val ⇒ Object
Returns the value of attribute val.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 4 def val @val end |
Instance Method Details
#copy ⇒ Object
25 26 27 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 25 def copy BordersProperties.new(@color, @sz, @val, @space) end |
#nil? ⇒ Boolean
16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 16 def nil? @sz.zero? && val == :none end |
#parse(node) ⇒ BordersProperties
Parse BordersProperties
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/borders_properties.rb', line 37 def parse(node) return nil if node.attribute('val').value == 'nil' node.attributes.each do |key, value| case key when 'val' @val = value.value.to_sym when 'sz' @sz = OoxmlSize.new(value.value.to_f, :one_eighth_point) when 'space' @space = OoxmlSize.new(value.value.to_f, :point) when 'color' @color = value.value.to_s @color = Color.new(parent: self).parse_hex_string(@color) if @color != 'auto' when 'shadow' @shadow = value.value end end self end |
#to_s ⇒ Object
20 21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 20 def to_s return '' if nil? "borders color: #{@color}, size: #{@sz}, space: #{@space}, value: #{@val}" end |
#visible? ⇒ Boolean
29 30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 29 def visible? return false if nil? val != 'none' end |