Sha256: 8d6f827665de7a7fa4208b26d9be8b8ec86c3e86d374050476ee1c867c411686

Contents?: true

Size: 743 Bytes

Versions: 12

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  class Element
    class Query
      # class MultipleResults - use to query for multiple results
      class MultipleResults < Query
        # Find multiple elements
        # The supplied block will be used to decorate the results
        # @param [Capybara::Node::Element] capybara_element the element to be searched within
        # @return [Array<Capybara::Node::Element>] the results
        def find(capybara_element, &block)
          results = capybara_element.all(*selector_args, **options).to_a.tap do |result|
            raise Capybara::ElementNotFound if result.empty?
          end
          results.collect { |result| block.call(result) }
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
page_magic-2.0.13 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.12 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.11 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.10 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.9 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.6 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.5 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.4 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.3 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.2 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.1 lib/page_magic/element/query/multiple_results.rb
page_magic-2.0.0 lib/page_magic/element/query/multiple_results.rb