Class: Rspreadsheet::RowGroup

Inherits:
RowWithXMLNode show all
Defined in:
lib/rspreadsheet/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RowWithXMLNode

#add_cell, #cellnodes, #cells, #first_unused_column_index, #nonemptycells, #nonemptycellsindexes, #style_name=, #used_col_range, #used_range

Methods inherited from Row

empty_row_node

Constructor Details

#initialize(aparent_array, arange, axmlnode = nil) ⇒ RowGroup

Returns a new instance of RowGroup.



181
182
183
184
185
186
187
188
189
# File 'lib/rspreadsheet/row.rb', line 181

def initialize(aparent_array,arange,axmlnode=nil)
  @parent_array = aparent_array
  @range = arange
  if axmlnode.nil?
    axmlnode = Row.empty_row_node
    Tools.set_ns_attribute(axmlnode,'table','number-rows-repeated',range.size) if range.size>1
  end
  @xmlnode = axmlnode
end

Instance Attribute Details

#parent_arrayObject

Returns the value of attribute parent_array.



180
181
182
# File 'lib/rspreadsheet/row.rb', line 180

def parent_array
  @parent_array
end

#rangeObject

Returns the value of attribute range.



179
180
181
# File 'lib/rspreadsheet/row.rb', line 179

def range
  @range
end

#xmlnodeObject

Returns the value of attribute xmlnode.



180
181
182
# File 'lib/rspreadsheet/row.rb', line 180

def xmlnode
  @xmlnode
end

Instance Method Details

#normalizeObject

returns SingleRow if size of range is 1 and nil if it is 0 or less



191
192
193
194
195
196
197
# File 'lib/rspreadsheet/row.rb', line 191

def normalize
  case range.size
    when 2..Float::INFINITY then self
    when 1 then SingleRow.new_from_rowgroup(self)
    else nil
  end
end

#repeatedObject



198
# File 'lib/rspreadsheet/row.rb', line 198

def repeated;  range.size   end

#repeated?Boolean

Returns:

  • (Boolean)


199
# File 'lib/rspreadsheet/row.rb', line 199

def repeated?; range.size>1 end