Class: OOXL::Font
- Inherits:
-
Object
- Object
- OOXL::Font
- Defined in:
- lib/ooxl/xl_objects/font.rb
Instance Attribute Summary collapse
-
#bold ⇒ Object
(also: #bold?)
Returns the value of attribute bold.
-
#color_index ⇒ Object
Returns the value of attribute color_index.
-
#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.
5 6 7 |
# File 'lib/ooxl/xl_objects/font.rb', line 5 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.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def bold @bold end |
#color_index ⇒ Object
Returns the value of attribute color_index.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def color_index @color_index end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def name @name end |
#rgb_color ⇒ Object
Returns the value of attribute rgb_color.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def rgb_color @rgb_color end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def size @size end |
#theme ⇒ Object
Returns the value of attribute theme.
3 4 5 |
# File 'lib/ooxl/xl_objects/font.rb', line 3 def theme @theme end |
Class Method Details
.load_from_node(font_node) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ooxl/xl_objects/font.rb', line 8 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) , color_index: font_color_node && font_color_node.attributes["indexed"].try(:value), theme: font_color_node && font_color_node.attributes["theme"].try(:value), bold: font_bold_node.present?, ) end |