Class: Capybara::Selector::Filters::Base
- Inherits:
-
Object
- Object
- Capybara::Selector::Filters::Base
show all
- Defined in:
- lib/capybara/selector/filters/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(name, matcher, block, **options) ⇒ Base
Returns a new instance of Base.
7
8
9
10
11
12
13
|
# File 'lib/capybara/selector/filters/base.rb', line 7
def initialize(name, matcher, block, **options)
@name = name
@matcher = matcher
@block = block
@options = options
@options[:valid_values] = [true, false] if options[:boolean]
end
|
Instance Method Details
#default ⇒ Object
19
20
21
|
# File 'lib/capybara/selector/filters/base.rb', line 19
def default
@options[:default]
end
|
#default? ⇒ Boolean
15
16
17
|
# File 'lib/capybara/selector/filters/base.rb', line 15
def default?
@options.key?(:default)
end
|
#handles_option?(option_name) ⇒ Boolean
31
32
33
34
35
36
37
|
# File 'lib/capybara/selector/filters/base.rb', line 31
def handles_option?(option_name)
if matcher?
option_name =~ @matcher
else
@name == option_name
end
end
|
#matcher? ⇒ Boolean
27
28
29
|
# File 'lib/capybara/selector/filters/base.rb', line 27
def matcher?
!@matcher.nil?
end
|
#skip?(value) ⇒ Boolean
23
24
25
|
# File 'lib/capybara/selector/filters/base.rb', line 23
def skip?(value)
@options.key?(:skip_if) && value == @options[:skip_if]
end
|