Class: Capybara::Selector::FilterSet
- Inherits:
-
Object
- Object
- Capybara::Selector::FilterSet
- Defined in:
- lib/capybara/selector/filter_set.rb
Instance Attribute Summary collapse
-
#descriptions ⇒ Object
readonly
Returns the value of attribute descriptions.
Class Method Summary collapse
Instance Method Summary collapse
- #describe(&block) ⇒ Object
- #description(options = {}) ⇒ Object
- #filter(name, options = {}, &block) ⇒ Object
- #filters ⇒ Object
-
#initialize(name, &block) ⇒ FilterSet
constructor
A new instance of FilterSet.
Constructor Details
#initialize(name, &block) ⇒ FilterSet
Returns a new instance of FilterSet.
9 10 11 12 13 |
# File 'lib/capybara/selector/filter_set.rb', line 9 def initialize(name, &block) @name = name @descriptions = [] instance_eval(&block) end |
Instance Attribute Details
#descriptions ⇒ Object (readonly)
Returns the value of attribute descriptions.
7 8 9 |
# File 'lib/capybara/selector/filter_set.rb', line 7 def descriptions @descriptions end |
Class Method Details
.add(name, &block) ⇒ Object
36 37 38 |
# File 'lib/capybara/selector/filter_set.rb', line 36 def add(name, &block) all[name.to_sym] = FilterSet.new(name.to_sym, &block) end |
.all ⇒ Object
32 33 34 |
# File 'lib/capybara/selector/filter_set.rb', line 32 def all @filter_sets ||= {} end |
.remove(name) ⇒ Object
40 41 42 |
# File 'lib/capybara/selector/filter_set.rb', line 40 def remove(name) all.delete(name.to_sym) end |
Instance Method Details
#describe(&block) ⇒ Object
19 20 21 |
# File 'lib/capybara/selector/filter_set.rb', line 19 def describe(&block) descriptions.push block end |
#description(options = {}) ⇒ Object
23 24 25 |
# File 'lib/capybara/selector/filter_set.rb', line 23 def description(={}) @descriptions.map {|desc| desc.call().to_s }.join end |
#filter(name, options = {}, &block) ⇒ Object
15 16 17 |
# File 'lib/capybara/selector/filter_set.rb', line 15 def filter(name, ={}, &block) filters[name] = Filter.new(name, block, ) end |
#filters ⇒ Object
27 28 29 |
# File 'lib/capybara/selector/filter_set.rb', line 27 def filters @filters ||= {} end |