Class: OOXML::Excel::Sheet::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_excel/sheet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ Column

Returns a new instance of Column.



121
122
123
# File 'lib/ooxml_excel/sheet.rb', line 121

def initialize(**attrs)
  attrs.each { |property, value| send("#{property}=", value)}
end

Instance Attribute Details

#custom_widthObject

Returns the value of attribute custom_width.



118
119
120
# File 'lib/ooxml_excel/sheet.rb', line 118

def custom_width
  @custom_width
end

#hiddenObject Also known as: hidden?

Returns the value of attribute hidden.



118
119
120
# File 'lib/ooxml_excel/sheet.rb', line 118

def hidden
  @hidden
end

#idObject

Returns the value of attribute id.



118
119
120
# File 'lib/ooxml_excel/sheet.rb', line 118

def id
  @id
end

#id_rangeObject

Returns the value of attribute id_range.



118
119
120
# File 'lib/ooxml_excel/sheet.rb', line 118

def id_range
  @id_range
end

#widthObject

Returns the value of attribute width.



118
119
120
# File 'lib/ooxml_excel/sheet.rb', line 118

def width
  @width
end

Class Method Details

.load_from_node(column_node) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/ooxml_excel/sheet.rb', line 125

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