Class: Watir::AttributeLengthPairs
- Inherits:
 - 
      Object
      
        
- Object
 - Watir::AttributeLengthPairs
 
 
- Defined in:
 - lib/watir/collections.rb
 
Overview
This class is used as part of the .show method of the iterators class it would not normally be used by a user
Defined Under Namespace
Classes: AttributeLengthHolder
Instance Method Summary collapse
- 
  
    
      #add(attrib, length)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
BUG: Untested.
 - #delete(attrib) ⇒ Object
 - #each ⇒ Object
 - 
  
    
      #initialize(attrib = nil, length = nil)  ⇒ AttributeLengthPairs 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of AttributeLengthPairs.
 - #next ⇒ Object
 
Constructor Details
#initialize(attrib = nil, length = nil) ⇒ AttributeLengthPairs
Returns a new instance of AttributeLengthPairs.
      34 35 36 37 38  | 
    
      # File 'lib/watir/collections.rb', line 34 def initialize(attrib=nil, length=nil) @attr=[] add(attrib, length) if attrib @index_counter = 0 end  | 
  
Instance Method Details
#add(attrib, length) ⇒ Object
BUG: Untested. (Null implementation passes all tests.)
      41 42 43  | 
    
      # File 'lib/watir/collections.rb', line 41 def add(attrib, length) @attr << AttributeLengthHolder.new(attrib, length) end  | 
  
#delete(attrib) ⇒ Object
      45 46 47 48 49 50 51  | 
    
      # File 'lib/watir/collections.rb', line 45 def delete(attrib) item_to_delete = nil @attr.each_with_index do |e,i| item_to_delete = i if e.attribute == attrib end @attr.delete_at(item_to_delete) unless item_to_delete == nil end  | 
  
#each ⇒ Object
      59 60 61  | 
    
      # File 'lib/watir/collections.rb', line 59 def each 0.upto(@attr.length-1) { |i | yield @attr[i] } end  | 
  
#next ⇒ Object
      53 54 55 56 57  | 
    
      # File 'lib/watir/collections.rb', line 53 def next temp = @attr[@index_counter] @index_counter += 1 return temp end  |