Class: Capybara::Playwright::PageExtension::DialogMessageMatcher
- Inherits:
-
Object
- Object
- Capybara::Playwright::PageExtension::DialogMessageMatcher
- Defined in:
- lib/capybara/playwright/page.rb
Instance Method Summary collapse
-
#initialize(text_or_regex_or_nil) ⇒ DialogMessageMatcher
constructor
A new instance of DialogMessageMatcher.
- #matches?(message) ⇒ Boolean
Constructor Details
#initialize(text_or_regex_or_nil) ⇒ DialogMessageMatcher
Returns a new instance of DialogMessageMatcher.
71 72 73 74 75 76 77 |
# File 'lib/capybara/playwright/page.rb', line 71 def initialize(text_or_regex_or_nil) if [NilClass, Regexp, String].none? { |k| text_or_regex_or_nil.is_a?(k) } raise ArgumentError.new("invalid type: #{text_or_regex_or_nil.inspect}") end @filter = text_or_regex_or_nil end |
Instance Method Details
#matches?(message) ⇒ Boolean
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/capybara/playwright/page.rb', line 79 def matches?() case @filter when nil true when Regexp =~ @filter when String &.include?(@filter) end end |