lib/grape/api.rb in grape-1.0.1 vs lib/grape/api.rb in grape-1.0.2
- old
+ new
@@ -159,11 +159,11 @@
route_settings[:methods] ||= []
route_settings[:methods] << route.request_method
route_settings[:endpoint] = route.app
# using the :any shorthand produces [nil] for route methods, substitute all manually
- route_settings[:methods] = %w(GET PUT POST DELETE PATCH HEAD OPTIONS) if route_settings[:methods].include?('*')
+ route_settings[:methods] = %w[GET PUT POST DELETE PATCH HEAD OPTIONS] if route_settings[:methods].include?('*')
end
end
# The paths we collected are prepared (cf. Path#prepare), so they
# contain already versioning information when using path versioning.
@@ -193,10 +193,10 @@
end
# Generate a route that returns an HTTP 405 response for a user defined
# path on methods not specified
def generate_not_allowed_method(pattern, allowed_methods: [], **attributes)
- not_allowed_methods = %w(GET PUT POST DELETE PATCH HEAD) - allowed_methods
+ not_allowed_methods = %w[GET PUT POST DELETE PATCH HEAD] - allowed_methods
not_allowed_methods << Grape::Http::Headers::OPTIONS if self.class.namespace_inheritable(:do_not_route_options)
return if not_allowed_methods.empty?
@router.associate_routes(pattern, not_allowed_methods: not_allowed_methods, **attributes)