health 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,11 @@ module Health
9
9
  end
10
10
 
11
11
  def configure(&block)
12
- checker.configure(&block)
12
+ instance_eval(&block)
13
+ end
14
+
15
+ def check(name_or_object, &block)
16
+ checker.check(name_or_object, &block)
13
17
  end
14
18
 
15
19
  def perform(name)
@@ -4,18 +4,18 @@ module Health
4
4
  @checks ||= {}
5
5
  end
6
6
 
7
- def configure(&block)
8
- instance_eval(&block)
9
- end
10
-
11
7
  def check(name_or_object, &block)
12
8
  if name_or_object.respond_to?(:call)
13
- checks[name_or_object.name] = name_or_object
9
+ checks[name_or_object.name.to_sym] = name_or_object
14
10
  else
15
- checks[name_or_object] = block
11
+ checks[name_or_object.to_sym] = block
16
12
  end
17
13
  end
18
14
 
15
+ def has_check?(name)
16
+ checks.has_key?(name.to_sym)
17
+ end
18
+
19
19
  def names
20
20
  checks.keys
21
21
  end
@@ -15,7 +15,7 @@ module Health
15
15
  end
16
16
 
17
17
  get "/:name" do
18
- pass if !Health.names.include?(params[:name].to_sym)
18
+ pass if !Health.has_check?(params[:name])
19
19
 
20
20
  value = Health.perform(params[:name])
21
21
  status = value[:ok] ? 200 : 500
@@ -1,3 +1,3 @@
1
1
  module Health
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70364561163080 !ruby/object:Gem::Requirement
16
+ requirement: &70196110738220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70364561163080
24
+ version_requirements: *70196110738220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &70364561162660 !ruby/object:Gem::Requirement
27
+ requirement: &70196110737800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70364561162660
35
+ version_requirements: *70196110737800
36
36
  description: Health checks for rails.
37
37
  email:
38
38
  - jamesgolick@gmail.com