Sha256: 00b6f1b8e727dbaf7e8e87562557fec81660ec14541f92f7684aa40d63a43e40

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 Bytes

Contents

module POI
  class Rows
    include Enumerable
    
    def initialize(worksheet)
      @worksheet = worksheet
      @poi_worksheet = worksheet.poi_worksheet
    end

    def [](index)
      Row.new(@poi_worksheet.getRow(index))
    end

    def size 
      @poi_worksheet.getPhysicalNumberOfRows 
    end

    def each
      it = @poi_worksheet.rowIterator
      yield Row.new(it.next) while it.hasNext
    end
  end

  class Row
    def initialize(row)
      @row = row
    end
    
    def [](index)
      Cell.new(@row.getCell(index))
    end

    def cells
      Cells.new(self)
    end

    def index
      @row.getRowNum
    end    

    def poi_row
      @row
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jruby-poi-0.5.2 lib/poi/workbook/row.rb
jruby-poi-0.5.1 lib/poi/workbook/row.rb
jruby-poi-0.5.0 lib/poi/workbook/row.rb
jruby-poi-0.4.0 lib/poi/workbook/row.rb