Class: OoxmlParser::Underline
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Underline
- Defined in:
- lib/ooxml_parser/common_parser/common_data/underline.rb
Overview
Class for parsing u tags
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#style ⇒ Object
Returns the value of attribute style.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(style = :none, color = nil, parent: nil) ⇒ Underline
constructor
A new instance of Underline.
-
#parse(node) ⇒ Underline
Parse Underline object.
- #to_s ⇒ Object
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(style = :none, color = nil, parent: nil) ⇒ Underline
Returns a new instance of Underline.
6 7 8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 6 def initialize(style = :none, color = nil, parent: nil) @style = style == 'single' ? :single : style @color = color @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/underline.rb', line 4 def color @color end |
#style ⇒ Object
Returns the value of attribute style.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 4 def style @style end |
Instance Method Details
#==(other) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 12 def ==(other) if other.is_a? Underline @style.to_sym == other.style.to_sym && @color == other.color elsif other.is_a? Symbol @style.to_sym == other else false end end |
#parse(node) ⇒ Underline
Parse Underline object
33 34 35 36 37 38 39 40 41 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 33 def parse(node) case node when 'sng' @style = :single when 'none' @style = :none end self end |
#to_s ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 22 def to_s if @color.nil? @style.to_s else "#{@style} #{@color}" end end |