Class: MiniCheck::RackApp
- Inherits:
-
Object
- Object
- MiniCheck::RackApp
- Defined in:
- lib/mini_check/rack_app.rb
Instance Attribute Summary collapse
-
#checks ⇒ Object
Returns the value of attribute checks.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(args = {}) ⇒ RackApp
constructor
A new instance of RackApp.
- #register(name, &block) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ RackApp
Returns a new instance of RackApp.
6 7 8 |
# File 'lib/mini_check/rack_app.rb', line 6 def initialize args = {} set_attributes args end |
Instance Attribute Details
#checks ⇒ Object
Returns the value of attribute checks.
3 4 5 |
# File 'lib/mini_check/rack_app.rb', line 3 def checks @checks end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/mini_check/rack_app.rb', line 4 def path @path end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/mini_check/rack_app.rb', line 14 def call env case "#{env['REQUEST_METHOD']} #{env['PATH_INFO']}" when "GET #{path}" checks.run [status, headers, [body]] else [404, headers, []] end end |
#register(name, &block) ⇒ Object
24 25 26 |
# File 'lib/mini_check/rack_app.rb', line 24 def register name, &block checks.register name, &block end |