Module: Grape::Middleware::Versioner

Defined in:
lib/grape/middleware/versioner.rb,
lib/grape/middleware/versioner/path.rb,
lib/grape/middleware/versioner/param.rb,
lib/grape/middleware/versioner/header.rb,
lib/grape/middleware/versioner/accept_version_header.rb

Defined Under Namespace

Classes: AcceptVersionHeader, Header, Param, Path

Class Method Summary collapse

Class Method Details

.using(strategy) ⇒ Object

Returns a middleware class based on strategy.

Parameters:

  • strategy (Symbol)

    :path, :header, :accept_version_header or :param

Returns:

  • a middleware class based on strategy



18
19
20
21
22
# File 'lib/grape/middleware/versioner.rb', line 18

def using(strategy)
  Grape::Middleware::Versioner.const_get(:"#{strategy.to_s.camelize}")
rescue NameError
  raise Grape::Exceptions::InvalidVersionerOption, strategy
end