123456789_123456789_123456789_123456789_123456789_

Class: Capybara::Selector::Filters::LocatorFilter

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, NodeFilter, Base
Instance Chain:
self, NodeFilter, Base
Inherits: Capybara::Selector::Filters::NodeFilter
Defined in: lib/capybara/selector/filters/locator_filter.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(block, **options) ⇒ LocatorFilter

[ GitHub ]

  
# File 'lib/capybara/selector/filters/locator_filter.rb', line 9

def initialize(block, **options)
  super(nil, nil, block, **options)
end

Instance Method Details

#apply(subject, value, skip_value, ctx, **options) (private)

[ GitHub ]

  
# File 'lib/capybara/selector/filters/locator_filter.rb', line 21

def apply(subject, value, skip_value, ctx, **options)
  return skip_value if skip?(value)

  filter_context(ctx).instance_exec(subject, value, **options, &@block)
end

#matches?(node, value, context = nil, exact:) ⇒ Boolean

[ GitHub ]

  
# File 'lib/capybara/selector/filters/locator_filter.rb', line 13

def matches?(node, value, context = nil, exact:)
  apply(node, value, true, context, exact: exact, format: context&.default_format)
rescue Capybara::ElementNotFound
  false
end