Class: Trane::Docs::App

Inherits:
Object
  • Object
show all
Defined in:
lib/trane/docs/app.rb

Overview

Rack middleware-style app that serves documentation endpoints. Mounted by the Trane::Engine at the path chosen by the host application.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/trane/docs/app.rb', line 8

def call(env)
  request = Rack::Request.new(env)
  if request.path_info.end_with?(".json")
    serve_json
  else
    serve_html
  end
end