Sha256: 67ba63f49d98d074c5a9ac074e8bcf300e782f20a1937adc6baa16ea985a8ec0

Contents?: true

Size: 313 Bytes

Versions: 5

Compression:

Stored size: 313 Bytes

Contents

module VersionCake
  class PathParameterStrategy < ExtractionStrategy

    def execute(request)
      version = nil
      request.path.split('/').find do |part|
        next unless match = part.match(%r{v(?<version>\d+)})
        version = match[:version]
        break
      end
      version
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
versioncake-3.4.0 lib/versioncake/strategies/path_parameter_strategy.rb
versioncake-3.3.0 lib/versioncake/strategies/path_parameter_strategy.rb
versioncake-3.2.0 lib/versioncake/strategies/path_parameter_strategy.rb
versioncake-3.1.0 lib/versioncake/strategies/path_parameter_strategy.rb
versioncake-3.0.0 lib/versioncake/strategies/path_parameter_strategy.rb