Skip to content

Commit

Permalink
DRYed the options[:auth_wrapper].
Browse files Browse the repository at this point in the history
  • Loading branch information
texpert committed Sep 8, 2016
1 parent 621ff5b commit 7581add
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/grape-swagger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ def add_swagger_documentation(options = {})
version_for(options)
options = { target_class: self }.merge(options)
@target_class = options[:target_class]
auth_wrapper = options[:endpoint_auth_wrapper]

if !options[:endpoint_auth_wrapper].nil? &&
options[:endpoint_auth_wrapper].method_defined?(:before) &&
!middleware.flatten.include?(options[:endpoint_auth_wrapper])
use options[:endpoint_auth_wrapper]
if auth_wrapper && auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper)
use auth_wrapper
end

documentation_class.setup(options)
Expand Down

0 comments on commit 7581add

Please sign in to comment.