Class: AePageObjects::DocumentLoader
- Inherits:
-
Object
- Object
- AePageObjects::DocumentLoader
- Includes:
- PagePolling
- Defined in:
- lib/ae_page_objects/document_loader.rb
Instance Method Summary collapse
-
#initialize(query, strategy) ⇒ DocumentLoader
constructor
A new instance of DocumentLoader.
- #load ⇒ Object
Constructor Details
#initialize(query, strategy) ⇒ DocumentLoader
Returns a new instance of DocumentLoader.
7 8 9 10 |
# File 'lib/ae_page_objects/document_loader.rb', line 7 def initialize(query, strategy) @query = query @strategy = strategy end |
Instance Method Details
#load ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ae_page_objects/document_loader.rb', line 12 def load begin poll_until do @query.conditions.each do |document_condition| if document = @strategy.load_document_with_condition(document_condition) return document end end nil end rescue AePageObjects::WaitTimeoutError end raise DocumentLoadError, @strategy.(@query) end |