Class: OoxmlParser::BordersProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::BordersProperties
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/ooxml_parser/common_parser/common_data/borders_properties.rb
Overview
Border Properties Data
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.
-
#size ⇒ OoxmlSize
readonly
Size of border.
-
#space ⇒ Object
Returns the value of attribute space.
-
#val ⇒ Object
Returns the value of attribute val.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#copy ⇒ BordersProperties
Method to copy object.
-
#initialize(color = :auto, size = 0, val = :none, space = 0, parent: nil) ⇒ BordersProperties
constructor
A new instance of BordersProperties.
- #nil? ⇒ Boolean
-
#parse(node) ⇒ BordersProperties
Parse BordersProperties.
-
#sz ⇒ OoxmlSize
Alias for sz.
-
#to_s ⇒ String
Result of convert of object to string.
- #visible? ⇒ Boolean
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(color = :auto, size = 0, val = :none, space = 0, parent: nil) ⇒ BordersProperties
Returns a new instance of BordersProperties.
10 11 12 13 14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 10 def initialize(color = :auto, size = 0, val = :none, space = 0, parent: nil) @color = color @size = size @val = val @space = space super(parent: parent) end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def color @color end |
#frame ⇒ Object
Returns the value of attribute frame.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def frame @frame end |
#shadow ⇒ Object
Returns the value of attribute shadow.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def shadow @shadow end |
#side ⇒ Object
Returns the value of attribute side.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def side @side end |
#size ⇒ OoxmlSize (readonly)
Returns size of border.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 8 def size @size end |
#space ⇒ Object
Returns the value of attribute space.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def space @space end |
#val ⇒ Object
Returns the value of attribute val.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 6 def val @val end |
Instance Method Details
#copy ⇒ BordersProperties
Method to copy object
39 40 41 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 39 def copy BordersProperties.new(@color, size, @val, @space) end |
#nil? ⇒ Boolean
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 26 def nil? size.zero? && val == :none end |
#parse(node) ⇒ BordersProperties
Parse BordersProperties
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 52 def parse(node) node.attributes.each do |key, value| case key when 'val' @val = value.value.to_sym when 'sz' @size = 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 return nil if @val == :nil self end |
#sz ⇒ OoxmlSize
Returns alias for sz.
19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 19 def sz size end |
#to_s ⇒ String
Returns result of convert of object to string.
31 32 33 34 35 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 31 def to_s return '' if nil? "borders color: #{@color}, size: #{size}, space: #{@space}, value: #{@val}" end |
#visible? ⇒ Boolean
43 44 45 46 47 |
# File 'lib/ooxml_parser/common_parser/common_data/borders_properties.rb', line 43 def visible? return false if nil? val != 'none' end |