Method: Coopy::CompareTable#has_same_columns_2

Defined in:
lib/coopy/compare_table.rb

#has_same_columns_2(a, b) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/coopy/compare_table.rb', line 254

def has_same_columns_2(a, b)
  if (a.width!=b.width) 
    return false
  end
  if (a.height==0 || b.height==0) 
    return true
  end

  # check for a blatant header - should only do this
  # for meta-data free tables, that may have embedded headers
  av = a.get_cell_view
  (0..a.width-1).each do |i|
    ((i+1)..a.width-1).each do |j|
      if (av.equals(a.get_cell(i,0),a.get_cell(j,0))) 
        return false
      end
    end
    if (!av.equals(a.get_cell(i,0),b.get_cell(i,0))) 
      return false
    end
  end

  return true
end