Sha256: 88f460b104762f3a20e98f62abd8d67f064918c93a2e963bda16bd36c5fc7329

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

module Symbiont
  module WebObjects
    
    class TableRow < WebObject
      
      # This method is used to return a TableCell object based on the index provided.
      # @return [Symbiont::WebObjects::TableCell]
      def [](index)
        Object::Symbiont::WebObjects::TableCell.new(@web_object[index])
      end
      
      # This method is an iterator that returns a TableCell object each time through
      # the loop.
      # @return [Symbiont::WebObjects::TableCell]
      def each
        for index in 1..self.columns do
          yield self[index - 1]
        end
      end
      
      # This method returns the number of columns in a table object.
      def columns
        @web_object.wd.find_elements(:xpath, cell_xpath).size
      end
      
      protected
      
      def cell_xpath
        ".//child::td|th"
      end
      
    end # class: TableRow
    
  end # module: WebObjects
end # module: Symbiont

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
symbiont-0.1.1 lib/symbiont/web_objects/table_row.rb