Class: OoxmlParser::FontStyle
- Inherits:
-
Object
- Object
- OoxmlParser::FontStyle
- Defined in:
- lib/ooxml_parser/common_parser/common_data/font_style.rb
Overview
Class for working with font styles (bold,italic,underlined,strike)
Instance Attribute Summary collapse
-
#bold ⇒ false, true
Is bold?.
-
#italic ⇒ false, true
Is bold?.
-
#strike ⇒ Strike
Strike type.
-
#underlined ⇒ Underline
Underline type.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Default == operator.
-
#initialize(bold = false, italic = false, underlined = Underline.new(:none), strike = :none) ⇒ FontStyle
constructor
Default constructor.
-
#to_s ⇒ String
Default to_s operator.
Constructor Details
#initialize(bold = false, italic = false, underlined = Underline.new(:none), strike = :none) ⇒ FontStyle
Default constructor
23 24 25 26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 23 def initialize(bold = false, italic = false, underlined = Underline.new(:none), strike = :none) @bold = bold @italic = italic @underlined = underlined == false || underlined.nil? ? Underline.new(:none) : underlined @strike = strike end |
Instance Attribute Details
#bold ⇒ false, true
Returns is bold?.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 9 def bold @bold end |
#italic ⇒ false, true
Returns is bold?.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 11 def italic @italic end |
#strike ⇒ Strike
Returns strike type.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 15 def strike @strike end |
#underlined ⇒ Underline
Returns underline type.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 13 def underlined @underlined end |
Instance Method Details
#==(other) ⇒ true, false
Default == operator
32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 32 def ==(other) (@bold == other.bold) && (@italic == other.italic) && (@underlined == other.underlined) && (@strike == other.strike) end |
#to_s ⇒ String
Default to_s operator
38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/font_style.rb', line 38 def to_s "Bold: #{@bold}, Italic: #{@italic}, Underlined: #{@underlined}, Strike: #{@strike}" end |