Class: OoxmlParser::Underline
- Inherits:
-
Object
- Object
- OoxmlParser::Underline
- Defined in:
- lib/ooxml_parser/common_parser/common_data/underline.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#style ⇒ Object
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(style = :none, color = nil) ⇒ Underline
constructor
A new instance of Underline.
- #to_s ⇒ Object
Constructor Details
#initialize(style = :none, color = nil) ⇒ Underline
Returns a new instance of Underline.
6 7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 6 def initialize(style = :none, color = nil) @style = (style == 'single') ? :single : style @color = color 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 |
Class Method Details
.parse(attribute_value) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 29 def self.parse(attribute_value) underline = Underline.new case attribute_value when 'sng' underline.style = :single when 'none' underline.style = :none end underline end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 11 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 |
#to_s ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ooxml_parser/common_parser/common_data/underline.rb', line 21 def to_s if @color.nil? @style.to_s else "#{@style} #{@color}" end end |