From a3c984c02273950ad99e247a09a9626cb9f4335d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zuzanna=20Stoli=C5=84ska?= Date: Thu, 3 Aug 2017 14:57:40 +0200 Subject: [PATCH] Refactor setting instance variables in SwaggerDocsController --- .../swagger_docs_controller.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/controllers/swagger_ui_engine/swagger_docs_controller.rb b/app/controllers/swagger_ui_engine/swagger_docs_controller.rb index feb35b5..a6d0412 100644 --- a/app/controllers/swagger_ui_engine/swagger_docs_controller.rb +++ b/app/controllers/swagger_ui_engine/swagger_docs_controller.rb @@ -29,21 +29,15 @@ def single_doc private def set_configs - @doc_expansion = set_doc_expansion - @json_editor = set_json_editor - @model_rendering = set_model_rendering - @request_headers = set_request_headers - @swagger_url = set_swagger_url - @validator_url = set_validator_url + SwaggerUiEngine::DEFAULTS.keys.each do |key| + instance_variable_set("@#{key}", self.send("set_#{key}")) + end end def set_oauth_configs - @oauth_app_name = set_oauth_app_name - @oauth_client_id = set_oauth_client_id - @oauth_client_secret = set_oauth_client_secret - @oauth_realm = set_oauth_realm - @oauth_query_string_params = set_oauth_query_string_params - @oauth_scope_separator = set_oauth_scope_separator + SwaggerUiEngine::OAUTH2_DEFAULTS.keys.each do |key| + instance_variable_set("@#{key}", self.send("set_#{key}")) + end end def single_doc_url?