Class: Capybara::Widgets::PageCollection
- Inherits:
-
Object
- Object
- Capybara::Widgets::PageCollection
- Includes:
- Singleton
- Defined in:
- lib/capybara/widgets/core/page_collection.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
Returns the value of attribute registry.
Instance Method Summary collapse
- #current_page_class ⇒ Object
-
#initialize ⇒ PageCollection
constructor
A new instance of PageCollection.
Constructor Details
#initialize ⇒ PageCollection
Returns a new instance of PageCollection.
13 14 15 16 |
# File 'lib/capybara/widgets/core/page_collection.rb', line 13 def initialize self.registry = Array.new @loaded = false end |
Instance Attribute Details
#registry ⇒ Object
Returns the value of attribute registry.
9 10 11 |
# File 'lib/capybara/widgets/core/page_collection.rb', line 9 def registry @registry end |
Instance Method Details
#current_page_class ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/capybara/widgets/core/page_collection.rb', line 18 def current_page_class load_classes unless @loaded klass = registry.detect do |page_class| if page_class.path_matcher? if page_class.path_matcher.is_a?(Regexp) Capybara.current_path =~ page_class.path_matcher elsif page_class.path_matcher.is_a?(String) Capybara.current_path.include?(page_class.path_matcher) end else if page_class.path? Capybara.current_path.include?(page_class.path) else false end end end raise "Not found" if klass.nil? klass end |