Sha256: 6a2f5ee32791e1b1d22462de88f25786c232e28fc44d4c4eb0129ad54e5b03b2

Contents?: true

Size: 953 Bytes

Versions: 22

Compression:

Stored size: 953 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
      @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 - Celerity.index_offset) >= @cells.length
        raise UnknownCellException, "Unable to locate a cell at index #{index}"
      end

      TableCell.new(self, :object, @cells[index - Celerity.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

22 entries across 22 versions & 3 rubygems

Version Path
celerity-0.8.6 lib/celerity/elements/table_row.rb
celerity-0.8.5 lib/celerity/elements/table_row.rb
celerity-0.8.4 lib/celerity/elements/table_row.rb
celerity-0.8.2 lib/celerity/elements/table_row.rb
celerity-0.8.1 lib/celerity/elements/table_row.rb
oki-celerity-0.8.2 lib/celerity/elements/table_row.rb
oki-celerity-0.8.1 lib/celerity/elements/table_row.rb
oki-celerity-0.8.1.dev lib/celerity/elements/table_row.rb
celerity-0.8.0 lib/celerity/elements/table_row.rb
celerity-0.8.0.beta.4 lib/celerity/elements/table_row.rb
celerity-0.8.0.beta.3 lib/celerity/elements/table_row.rb
celerity-0.8.0.beta.2 lib/celerity/elements/table_row.rb
celerity-0.8.0.beta.1 lib/celerity/elements/table_row.rb
fletcherm-culerity-0.2.9 vendor/gems/celerity-0.7.6/lib/celerity/elements/table_row.rb
fletcherm-culerity-0.2.8 vendor/gems/celerity-0.7.6/lib/celerity/elements/table_row.rb
celerity-0.7.9 lib/celerity/elements/table_row.rb
celerity-0.7.8 lib/celerity/elements/table_row.rb
fletcherm-culerity-0.2.7 vendor/gems/celerity-0.7.6/lib/celerity/elements/table_row.rb
celerity-0.7.7 lib/celerity/elements/table_row.rb
fletcherm-culerity-0.2.6 vendor/gems/celerity-0.7.6/lib/celerity/elements/table_row.rb