Skip to content

Commit a3c984c

Browse files
author
Zuzanna Stolińska
committed
Refactor setting instance variables in SwaggerDocsController
1 parent d188261 commit a3c984c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

app/controllers/swagger_ui_engine/swagger_docs_controller.rb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,15 @@ def single_doc
2929
private
3030

3131
def set_configs
32-
@doc_expansion = set_doc_expansion
33-
@json_editor = set_json_editor
34-
@model_rendering = set_model_rendering
35-
@request_headers = set_request_headers
36-
@swagger_url = set_swagger_url
37-
@validator_url = set_validator_url
32+
SwaggerUiEngine::DEFAULTS.keys.each do |key|
33+
instance_variable_set("@#{key}", self.send("set_#{key}"))
34+
end
3835
end
3936

4037
def set_oauth_configs
41-
@oauth_app_name = set_oauth_app_name
42-
@oauth_client_id = set_oauth_client_id
43-
@oauth_client_secret = set_oauth_client_secret
44-
@oauth_realm = set_oauth_realm
45-
@oauth_query_string_params = set_oauth_query_string_params
46-
@oauth_scope_separator = set_oauth_scope_separator
38+
SwaggerUiEngine::OAUTH2_DEFAULTS.keys.each do |key|
39+
instance_variable_set("@#{key}", self.send("set_#{key}"))
40+
end
4741
end
4842

4943
def single_doc_url?

0 commit comments

Comments
 (0)