Class: What::Modules::What
Instance Method Summary collapse
- #check! ⇒ Object
- #details ⇒ Object
- #health ⇒ Object
-
#initialize ⇒ What
constructor
A new instance of What.
Methods inherited from Base
Constructor Details
#initialize ⇒ What
Returns a new instance of What.
4 5 6 7 8 9 10 |
# File 'lib/what/modules/what.rb', line 4 def initialize super @config.each do |name, host| @config[name] = "http://#{host}:9428" end @whats = {} end |
Instance Method Details
#check! ⇒ Object
12 13 14 15 16 |
# File 'lib/what/modules/what.rb', line 12 def check! @config.map do |name, uri| Helpers.curl(uri) { |body| @whats[name] = JSON.parse(body) rescue nil } end end |
#details ⇒ Object
22 23 24 |
# File 'lib/what/modules/what.rb', line 22 def details @whats end |
#health ⇒ Object
18 19 20 |
# File 'lib/what/modules/what.rb', line 18 def health Helpers.overall_health(@whats.map { |_, attrs| attrs['health'] }) end |