Class: OOXML::Excel::Styles::Font
- Inherits:
-
Object
- Object
- OOXML::Excel::Styles::Font
- Defined in:
- lib/ooxml_excel/styles.rb
Instance Attribute Summary collapse
-
#bold ⇒ Object
(also: #bold?)
Returns the value of attribute bold.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rgb_color ⇒ Object
Returns the value of attribute rgb_color.
-
#size ⇒ Object
Returns the value of attribute size.
-
#theme ⇒ Object
Returns the value of attribute theme.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Font
constructor
A new instance of Font.
Constructor Details
#initialize(**attrs) ⇒ Font
Returns a new instance of Font.
57 58 59 |
# File 'lib/ooxml_excel/styles.rb', line 57 def initialize(**attrs) attrs.each { |property, value| send("#{property}=", value)} end |
Instance Attribute Details
#bold ⇒ Object Also known as: bold?
Returns the value of attribute bold.
55 56 57 |
# File 'lib/ooxml_excel/styles.rb', line 55 def bold @bold end |
#name ⇒ Object
Returns the value of attribute name.
55 56 57 |
# File 'lib/ooxml_excel/styles.rb', line 55 def name @name end |
#rgb_color ⇒ Object
Returns the value of attribute rgb_color.
55 56 57 |
# File 'lib/ooxml_excel/styles.rb', line 55 def rgb_color @rgb_color end |
#size ⇒ Object
Returns the value of attribute size.
55 56 57 |
# File 'lib/ooxml_excel/styles.rb', line 55 def size @size end |
#theme ⇒ Object
Returns the value of attribute theme.
55 56 57 |
# File 'lib/ooxml_excel/styles.rb', line 55 def theme @theme end |
Class Method Details
.load_from_node(font_node) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ooxml_excel/styles.rb', line 60 def self.load_from_node(font_node) font_size_node = font_node.at('sz') font_color_node = font_node.at('color') font_name_node = font_node.at('name') font_bold_node = font_node.at('b') self.new( size: font_size_node && font_size_node.attributes["val"].value, name: font_name_node && font_name_node.attributes["val"].value, rgb_color: font_color_node && font_color_node.attributes["rgb"].try(:value), theme: font_color_node && font_color_node.attributes["theme"].try(:value), bold: font_bold_node.present? ) end |