class OoxmlParser::Underline
Class for parsing `u` tags
Attributes
color[RW]
style[RW]
Public Class Methods
new(style = :none, color = nil, parent: nil)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 8 def initialize(style = :none, color = nil, parent: nil) @style = style == 'single' ? :single : style @color = color super(parent: parent) end
Public Instance Methods
==(other)
click to toggle source
Compare this object to other @param other [Object] any other object @return [True, False] result of comparision
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 17 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
parse(node)
click to toggle source
Parse Underline
object @param node [Nokogiri::XML:Element] node to parse @return [Underline] result of parsing
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 40 def parse(node) case node when 'sng' @style = :single when 'none' @style = :none end self end
to_s()
click to toggle source
@return [String] result of convert of object to string
# File lib/ooxml_parser/common_parser/common_data/underline.rb, line 29 def to_s if @color.nil? @style.to_s else "#{@style} #{@color}" end end