Class: OOXML::Excel::Sheet::Column
- Inherits:
-
Object
- Object
- OOXML::Excel::Sheet::Column
- Defined in:
- lib/ooxml_excel/sheet.rb
Instance Attribute Summary collapse
-
#custom_width ⇒ Object
Returns the value of attribute custom_width.
-
#hidden ⇒ Object
(also: #hidden?)
Returns the value of attribute hidden.
-
#id ⇒ Object
Returns the value of attribute id.
-
#id_range ⇒ Object
Returns the value of attribute id_range.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Column
constructor
A new instance of Column.
Constructor Details
#initialize(**attrs) ⇒ Column
Returns a new instance of Column.
126 127 128 |
# File 'lib/ooxml_excel/sheet.rb', line 126 def initialize(**attrs) attrs.each { |property, value| send("#{property}=", value)} end |
Instance Attribute Details
#custom_width ⇒ Object
Returns the value of attribute custom_width.
123 124 125 |
# File 'lib/ooxml_excel/sheet.rb', line 123 def custom_width @custom_width end |
#hidden ⇒ Object Also known as:
Returns the value of attribute hidden.
123 124 125 |
# File 'lib/ooxml_excel/sheet.rb', line 123 def hidden @hidden end |
#id ⇒ Object
Returns the value of attribute id.
123 124 125 |
# File 'lib/ooxml_excel/sheet.rb', line 123 def id @id end |
#id_range ⇒ Object
Returns the value of attribute id_range.
123 124 125 |
# File 'lib/ooxml_excel/sheet.rb', line 123 def id_range @id_range end |
#width ⇒ Object
Returns the value of attribute width.
123 124 125 |
# File 'lib/ooxml_excel/sheet.rb', line 123 def width @width end |
Class Method Details
.load_from_node(column_node) ⇒ Object
130 131 132 133 134 135 136 137 |
# File 'lib/ooxml_excel/sheet.rb', line 130 def self.load_from_node(column_node) hidden_attr = column_node.attributes["hidden"] new(id: column_node.attributes["min"].try(:value), width: column_node.attributes["width"].try(:value), custom_width: column_node.attributes["custom_width"].try(:value), id_range: (column_node.attributes["min"].value.to_i..column_node.attributes["max"].value.to_i).to_a, hidden: (hidden_attr.present?) ? hidden_attr.value == "1" : false) end |