Class: WaitForSolr
- Inherits:
-
Struct
- Object
- Struct
- WaitForSolr
- Defined in:
- lib/wait_for_solr.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
Returns the value of attribute port.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#port ⇒ Object
Returns the value of attribute port
5 6 7 |
# File 'lib/wait_for_solr.rb', line 5 def port @port end |
#timeout ⇒ Object
Returns the value of attribute timeout
5 6 7 |
# File 'lib/wait_for_solr.rb', line 5 def timeout @timeout end |
Class Method Details
.on(port, timeout, &block) ⇒ Object
6 7 8 |
# File 'lib/wait_for_solr.rb', line 6 def self.on(port, timeout, &block) new(port, timeout).wait &block end |
.running_on?(port) ⇒ Boolean
10 11 12 |
# File 'lib/wait_for_solr.rb', line 10 def self.running_on?(port) new(port).responding? end |
Instance Method Details
#responding? ⇒ Boolean
23 24 25 |
# File 'lib/wait_for_solr.rb', line 23 def responding? system %(curl -o /dev/null "http://localhost:#{port}/solr" > /dev/null 2>&1) end |
#wait ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/wait_for_solr.rb', line 14 def wait Timeout.timeout timeout do until responding? yield sleep 1 end end end |