Class: Apress::Documentation::SwaggerController

Inherits:
ActionController::Base
  • Object
show all
Includes:
PreloadDocs
Defined in:
app/controllers/apress/documentation/swagger_controller.rb

Instance Method Summary collapse

Methods included from PreloadDocs

#load_docs

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/apress/documentation/swagger_controller.rb', line 6

def show
  service = Apress::Documentation::SwaggerJsonBuilder.new(params[:slug])
  data =
    if Rails.application.config.action_controller.perform_caching
      key = ActiveSupport::Cache.expand_cache_key(["swagger_schema", params[:slug]])
      Rails.cache.fetch(key) { service.call }
    else
      service.call
    end

  render json: data
end