Class: Rspreadsheet::UninitializedEmptyRow

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

Overview

this is a row outside the used bounds. the main purpose of this object is to magically synchronize to existing data, once they are created

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LazyDetachableRow

#add_cell, #row, #style_name=

Methods inherited from Row

empty_row_node

Constructor Details

#initialize(aparent_array, arowi) ⇒ UninitializedEmptyRow

Returns a new instance of UninitializedEmptyRow.



272
273
274
275
# File 'lib/rspreadsheet/row.rb', line 272

def initialize(aparent_array,arowi)
  super(arowi)
  @parent_array = aparent_array
end

Instance Attribute Details

#parent_arrayObject (readonly)

debug only



271
272
273
# File 'lib/rspreadsheet/row.rb', line 271

def parent_array
  @parent_array
end

Instance Method Details

#cells(coli) ⇒ Object



276
277
278
279
280
281
282
# File 'lib/rspreadsheet/row.rb', line 276

def cells(coli)
  if still_out_of_used_range?
    Cell.new(self,coli,Cell.empty_cell_node).tap{|n| n.mode = :outbound}
  else
    @parent_array.get_row(@index).cells(coli)
  end
end

#detachObject



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

def detach; @parent_array.detach_of_bound_row_group(@index) end

#nonemptycellsObject



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

def nonemptycells; [] end

#normalizeObject



283
284
285
286
287
288
289
# File 'lib/rspreadsheet/row.rb', line 283

def normalize
  if still_out_of_used_range?
    self
  else
    @parent_array.get_row(@index)
  end
end

#still_out_of_used_range?Boolean

Returns:

  • (Boolean)


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

def still_out_of_used_range?; @index >= @parent_array.first_unused_row_index end

#xmlnodeObject



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

def xmlnode; Row.empty_row_node end