Sha256: b5fec450a1c6c54f32c764e5a9890c6d9b6b680bca18b084a03311774034e47e

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

module Celerity
  class TableRow < Element
    include Enumerable
    include ClickableElement

    TAGS = [ Identifier.new('tr') ]
    DEFAULT_HOW = :id

    def locate
      super
      @cells = @object.getCells if @object
    end

    # Yields each TableCell in this row cell to the given block.
    def each
      assert_exists
      @cells.each { |cell| yield TableCell.new(self, :object, cell) }
    end

    def child_cell(index)
      assert_exists

      if (index - INDEX_OFFSET) >= @cells.length
        raise UnknownCellException, "Unable to locate a cell at index #{index}"
      end

      TableCell.new(self, :object, @cells[index - INDEX_OFFSET])
    end
    alias_method :[], :child_cell

    def column_count
      assert_exists
      @cells.length
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jarib-celerity-0.0.5.5 lib/celerity/elements/table_row.rb