Sha256: b6b0b038fbd250f52db07caa95569e1047aad745cb7c893c0d4307aa821c000c

Contents?: true

Size: 823 Bytes

Versions: 18

Compression:

Stored size: 823 Bytes

Contents

module Celerity
  class TableElement < Element
    include Enumerable
    include ClickableElement

    ATTRIBUTES = BASE_ATTRIBUTES | CELLHALIGN_ATTRIBUTES | CELLVALIGN_ATTRIBUTES
    DEFAULT_HOW = :id

    def locate
      super
      @rows = @object.getRows if @object
    end

    def [](index)
      assert_exists
      TableRow.new(self, :object, @rows[index - INDEX_OFFSET])
    end

    def length
      assert_exists
      @object.getRows.length
    end

    def each
      assert_exists
      @rows.each { |row| yield TableRow.new(self, :object, row) }
    end
  end

  class TableBody < TableElement
    TAGS = [ Identifier.new('tbody') ]
  end

  class TableFooter < TableElement
    TAGS = [ Identifier.new('tfoot') ]
  end

  class TableHeader < TableElement
    TAGS = [ Identifier.new('thead') ]
  end

end

Version data entries

18 entries across 18 versions & 2 rubygems

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