lib/watir/window_collection.rb in watir-6.19.1 vs lib/watir/window_collection.rb in watir-7.0.0.beta1

- old
+ new

@@ -25,67 +25,23 @@ alias length count alias size count alias empty? none? - # - # First window of the collection - # - # @note windows in a collection are not ordered so this is not reliably - # @deprecated use Browser#switch_window or a better Window locator - # @return [Watir::Window] Returns an instance of a Watir::Window - # - - def first - self[0] + def [](*) + raise NoMethodError, 'indexing not reliable on WindowCollection' end + alias first [] + alias last [] + alias to_a [] - # - # Last window of the collection - # - # @note windows in a collection are not ordered so this is not reliably - # @deprecated use Browser#switch_window or a better Window locator - # @return [Watir::Window] Returns an instance of a Watir::Window - # - - def last - self[-1] - end - - # - # Get the window at the given index or range. - # - # @note windows in a collection are not ordered so this is not reliably - # @deprecated use Browser#switch_window or a better Window locator - # @param [Integer, Range] value Index (0-based) or Range of desired window(s) - # @return [Watir::Window] Returns an instance of a Watir::Window - # - - def [](value) - old = 'using indexing with windows' - new = 'Browser#switch_window or Browser#window with :title, :url or :element selectors' - reference = 'http://watir.com/window_indexes' - Watir.logger.deprecate old, new, reference: reference, ids: [:window_index] - - window_list[value] - end - def ==(other) window_list == other.send(:window_list) end alias eql? == def reset! @window_list = nil - end - - def to_a - old = 'WindowCollection#to_a to interact with indexed windows' - new = 'Enumerable methods to iterate over windows' - reference = 'http://watir.com/window_indexes' - Watir.logger.deprecate old, new, reference: reference, ids: [:window_index] - - window_list end private def window_list