Class: HealthRack::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/health_rack/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check(name, &block) ⇒ Object



12
13
14
# File 'lib/health_rack/base.rb', line 12

def check(name, &block)
  _checks << Check.new(name, &block)
end

.checksObject



8
9
10
# File 'lib/health_rack/base.rb', line 8

def checks
  _checks.dup
end

.title(title = @title) ⇒ Object



4
5
6
# File 'lib/health_rack/base.rb', line 4

def title(title = @title)
  @title = title || "Health status"
end

Instance Method Details

#call(env) ⇒ Object



23
24
25
# File 'lib/health_rack/base.rb', line 23

def call(env)
  Controller.new(env).perform(self)
end

#checksObject



31
32
33
# File 'lib/health_rack/base.rb', line 31

def checks
  self.class.checks
end

#resultsObject



35
36
37
# File 'lib/health_rack/base.rb', line 35

def results
  checks.each(&:perform)
end

#titleObject



27
28
29
# File 'lib/health_rack/base.rb', line 27

def title
  self.class.title
end