Sha256: c9fd82f2ecda8773586a55a368744b44966549a8d7c65fc80a780dc311e5f89a

Contents?: true

Size: 664 Bytes

Versions: 12

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  class Element
    class Query
      # class SingleResult - use to query when only one result should be expected
      class SingleResult < Query
        # Find an element
        # The supplied block will be used to decorate the results
        # @param [Capybara::Node::Element] capybara_element the element to be searched within
        # @return [Object] the results
        def find(capybara_element, &block)
          block.call capybara_element.find(*selector_args, **options)
        rescue Capybara::Ambiguous => e
          raise AmbiguousQueryException, e.message
        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/single_result.rb
page_magic-2.0.12 lib/page_magic/element/query/single_result.rb
page_magic-2.0.11 lib/page_magic/element/query/single_result.rb
page_magic-2.0.10 lib/page_magic/element/query/single_result.rb
page_magic-2.0.9 lib/page_magic/element/query/single_result.rb
page_magic-2.0.6 lib/page_magic/element/query/single_result.rb
page_magic-2.0.5 lib/page_magic/element/query/single_result.rb
page_magic-2.0.4 lib/page_magic/element/query/single_result.rb
page_magic-2.0.3 lib/page_magic/element/query/single_result.rb
page_magic-2.0.2 lib/page_magic/element/query/single_result.rb
page_magic-2.0.1 lib/page_magic/element/query/single_result.rb
page_magic-2.0.0 lib/page_magic/element/query/single_result.rb