Sha256: 637049d8137aa575208b34ff7bfa1e6429fa27c4a71d957ce8e83ffba2c30104

Contents?: true

Size: 932 Bytes

Versions: 15

Compression:

Stored size: 932 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

15 entries across 15 versions & 2 rubygems

Version Path
jarib-celerity-0.0.5.10 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.5.11 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.5.6 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.5.7 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.5.8 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.5.9 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.1 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.2 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.3 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.4 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.5 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.6 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6.7 lib/celerity/elements/table_row.rb
jarib-celerity-0.0.6 lib/celerity/elements/table_row.rb
celerity-0.0.6 lib/celerity/elements/table_row.rb