Class: GrapeSwagger::DocMethods::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/grape-swagger/doc_methods/version.rb

Class Method Summary collapse

Class Method Details

.get(route) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/grape-swagger/doc_methods/version.rb', line 7

def get(route)
  version = route.version
  # for grape version 0.16.2, the version can be a string like '[:v1, :v2]'
  # for grape version bigger than 0.16.2, the version can be a array like [:v1, :v2]
  if version.is_a?(String) && version.start_with?('[') && version.end_with?(']')
    instance_eval(version)
  else
    version
  end
end