Class: MiniCheck::ChecksCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/mini_check/checks_collection.rb

Instance Method Summary collapse

Instance Method Details

#healthy?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/mini_check/checks_collection.rb', line 12

def healthy?
  !detect{|c| !c.healthy? }
end

#register(name, &block) ⇒ Object



20
21
22
# File 'lib/mini_check/checks_collection.rb', line 20

def register name, &block
  self.<< Check.new(name, &block)
end

#runObject



16
17
18
# File 'lib/mini_check/checks_collection.rb', line 16

def run
  each{|c| c.run }
end

#to_hashObject



3
4
5
6
7
8
9
10
# File 'lib/mini_check/checks_collection.rb', line 3

def to_hash
  resp = {}
  each.map do |check|
    resp[check.name] = check.to_hash
  end

  resp
end