Sha256: f3b2be69b5ad26fb5426316f93c0fb447fcb2d992b2ff3f1532a503c90593955

Contents?: true

Size: 920 Bytes

Versions: 2

Compression:

Stored size: 920 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 to the given block.
    #

    def each
      assert_exists
      @cells.each { |cell| yield TableCell.new(self, :object, cell) }
    end

    #
    # Get the child cell at the given index
    #

    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

    #
    # Number of cells in this row.
    #

    def column_count
      assert_exists
      @cells.length
    end

  end # TableRow
end # Celerity

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jarib-celerity-0.0.6.8 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.9 lib/celerity/elements/table_row.rb