class OoxmlParser::Underline
Class for parsing ‘u` tags
Attributes
@return [Color] color of underline
@return [Symbol] value of underline
Public Class Methods
Source
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 12 def initialize(style = :none, color = nil, parent: nil) @style = style == 'single' ? :single : style @color = color super(parent: parent) end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 21 def ==(other) case other when Underline @style.to_sym == other.style.to_sym && @color == other.color when Symbol @style.to_sym == other else false end end
Compare this object to other @param other [Object] any other object @return [True, False] result of comparision
Source
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 44 def parse(node) parse_attributes(node) if node.is_a?(Nokogiri::XML::Element) case node when 'sng' @style = :single when 'none' @style = :none end self end
Parse Underline
object @param node [Nokogiri::XML:Element] node to parse @return [Underline] result of parsing
Source
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 33 def to_s if @color.nil? @style.to_s else "#{@style} #{@color}" end end
@return [String] result of convert of object to string
Private Instance Methods
Source
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 60 def parse_attributes(node) node.attributes.each do |key, value| case key when 'color' @color = Color.new(parent: self).parse_hex_string(value.value) when 'val' @value = value.value.to_sym end end end
Parse attributes @param node [Nokogiri::XML:Element] node to parse