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.



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_widthObject

Returns the value of attribute custom_width.



123
124
125
# File 'lib/ooxml_excel/sheet.rb', line 123

def custom_width
  @custom_width
end

#hiddenObject Also known as: hidden?

Returns the value of attribute hidden.



123
124
125
# File 'lib/ooxml_excel/sheet.rb', line 123

def hidden
  @hidden
end

#idObject

Returns the value of attribute id.



123
124
125
# File 'lib/ooxml_excel/sheet.rb', line 123

def id
  @id
end

#id_rangeObject

Returns the value of attribute id_range.



123
124
125
# File 'lib/ooxml_excel/sheet.rb', line 123

def id_range
  @id_range
end

#widthObject

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