Class: Schatz::Testers::IncrTest
- Inherits:
-
Object
- Object
- Schatz::Testers::IncrTest
- Defined in:
- lib/schatz/testers/incr_test.rb
Instance Attribute Summary collapse
-
#connections ⇒ Object
Returns the value of attribute connections.
-
#options ⇒ Object
Returns the value of attribute options.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #check_connections(connections) ⇒ Object
- #direct_check ⇒ Object
-
#initialize(options = {}, outputters = []) ⇒ IncrTest
constructor
A new instance of IncrTest.
- #links_check ⇒ Object
- #match_gcm_connections ⇒ Object
- #proxies ⇒ Object
Constructor Details
#initialize(options = {}, outputters = []) ⇒ IncrTest
Returns a new instance of IncrTest.
5 6 7 8 |
# File 'lib/schatz/testers/incr_test.rb', line 5 def initialize(={}, outputters=[]) = @outputters = outputters end |
Instance Attribute Details
#connections ⇒ Object
Returns the value of attribute connections.
4 5 6 |
# File 'lib/schatz/testers/incr_test.rb', line 4 def connections @connections end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/schatz/testers/incr_test.rb', line 4 def end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/schatz/testers/incr_test.rb', line 4 def output @output end |
Instance Method Details
#check_connections(connections) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/schatz/testers/incr_test.rb', line 10 def check_connections(connections) @connections = connections if [:direct_only] direct_check elsif [:proxy_only] links_check else direct_check links_check end @outputters.each { |outputter| outputter.generate } end |
#direct_check ⇒ Object
31 32 33 34 35 |
# File 'lib/schatz/testers/incr_test.rb', line 31 def direct_check match_gcm_connections.select { |c| c.direct? }.map do |connection| @outputters.each { |out| out.print(Input::ConnectionResult.new(connection).check) } end end |
#links_check ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/schatz/testers/incr_test.rb', line 23 def links_check match_gcm_connections.select { |c| c.link? }.map do |connection| proxies.map do |proxy| @outputters.each { |out| out.print(Input::ConnectionResult.new(connection, proxy).check) } end end end |
#match_gcm_connections ⇒ Object
37 38 39 |
# File 'lib/schatz/testers/incr_test.rb', line 37 def match_gcm_connections [:gcm] ? @connections.select { |c| c.gcm == [:gcm] } : @connections end |
#proxies ⇒ Object
41 42 43 |
# File 'lib/schatz/testers/incr_test.rb', line 41 def proxies [:proxies].values end |