Skip to content

Commit 82e1f21

Browse files
committed
Add local variable to keep versions from args
1 parent b0b9586 commit 82e1f21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/grape/dsl/routing.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ module ClassMethods
2828
#
2929
def version(*args, &block)
3030
if args.any?
31-
args.flatten!
3231
options = args.extract_options!
3332
options = options.reverse_merge(using: :path)
33+
requested_versions = args.flatten
3434

3535
raise Grape::Exceptions::MissingVendorOption.new if options[:using] == :header && !options.key?(:vendor)
3636

37-
@versions = versions | args
37+
@versions = versions | requested_versions
3838

3939
if block_given?
4040
within_namespace do
41-
namespace_inheritable(:version, args)
41+
namespace_inheritable(:version, requested_versions)
4242
namespace_inheritable(:version_options, options)
4343

4444
instance_eval(&block)
4545
end
4646
else
47-
namespace_inheritable(:version, args)
47+
namespace_inheritable(:version, requested_versions)
4848
namespace_inheritable(:version_options, options)
4949
end
5050
end

0 commit comments

Comments
 (0)