Class: Bard::Ping

Inherits:
Struct
  • Object
show all
Defined in:
lib/bard/ping.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#serverObject

Returns the value of attribute server

Returns:

  • (Object)

    the current value of server



5
6
7
# File 'lib/bard/ping.rb', line 5

def server
  @server
end

Class Method Details

.call(server) ⇒ Object



6
7
8
# File 'lib/bard/ping.rb', line 6

def self.call server
  new(server).call
end

Instance Method Details

#callObject



10
11
12
13
14
15
# File 'lib/bard/ping.rb', line 10

def call
  server.ping.reject do |url|
    response = get_response_with_redirect(url) rescue nil
    response.is_a?(Net::HTTPSuccess)
  end
end