Sha256: bcfe3385b098fcabffe03a39a3d64d180f85af73cdd48cccc4c96812256ef318

Contents?: true

Size: 750 Bytes

Versions: 9

Compression:

Stored size: 750 Bytes

Contents

module VersionCake
  module ResponseStrategy
    class Base
      def execute(_context, _status, _headers, _response)
        raise Exception, "ResponseStrategy requires execute to be implemented"
      end

      def version_key
        VersionCake.config.version_key
      end

      def self.lookup(strategy)
        case strategy
          when String, Symbol
            strategy_name = "#{strategy}_strategy".camelize
            begin
              VersionCake::ResponseStrategy.const_get(strategy_name).new
            rescue
              raise Exception, "Unknown VersionCake response strategy #{strategy_name}"
            end
          else
            raise Exception, "Invalid response strategy"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
versioncake-4.1.1 lib/versioncake/response_strategy/base.rb
versioncake-4.1.0 lib/versioncake/response_strategy/base.rb
versioncake-4.0.2 lib/versioncake/response_strategy/base.rb
versioncake-4.0.1 lib/versioncake/response_strategy/base.rb
versioncake-4.0.0 lib/versioncake/response_strategy/base.rb
versioncake-3.4.0 lib/versioncake/response_strategy/base.rb
versioncake-3.3.0 lib/versioncake/response_strategy/base.rb
versioncake-3.2.0 lib/versioncake/response_strategy/base.rb
versioncake-3.1.0 lib/versioncake/response_strategy/base.rb