Class: MiniCheck::VersionRackApp
- Inherits:
-
Object
- Object
- MiniCheck::VersionRackApp
- Defined in:
- lib/mini_check/version_rack_app.rb
Defined Under Namespace
Classes: JsonResponse, PlainTextResponse
Instance Attribute Summary collapse
-
#build_file ⇒ Object
Returns the value of attribute build_file.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(args = {}) ⇒ VersionRackApp
constructor
A new instance of VersionRackApp.
- #metadata ⇒ Object
- #new(app) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ VersionRackApp
Returns a new instance of VersionRackApp.
7 8 9 |
# File 'lib/mini_check/version_rack_app.rb', line 7 def initialize args = {} set_attributes args end |
Instance Attribute Details
#build_file ⇒ Object
Returns the value of attribute build_file.
5 6 7 |
# File 'lib/mini_check/version_rack_app.rb', line 5 def build_file @build_file end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/mini_check/version_rack_app.rb', line 5 def path @path end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mini_check/version_rack_app.rb', line 15 def call env case "#{env['REQUEST_METHOD']} #{env['PATH_INFO']}" when "GET #{path}.json" JsonResponse.render(output_hash) when "GET #{path}" PlainTextResponse.render(output_hash) else host_app.call(env) end end |
#metadata ⇒ Object
11 12 13 |
# File 'lib/mini_check/version_rack_app.rb', line 11 def @metadata ||= Hash.new end |
#new(app) ⇒ Object
26 27 28 29 30 |
# File 'lib/mini_check/version_rack_app.rb', line 26 def new(app) copy = self.dup copy.host_app = app copy end |