Sha256: 731dce5d778710a94778ce598f18a63240a231b39ab78275e291b3c4acfbb23c

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

module Wor
  module Batchifier
    class Strategy
      extend Wor::Batchifier::Interface

      implements :merge_strategy

      class << self
        alias_method :__new__, :new

        def new(*args)
          raise Wor::Batchifier::Exceptions::InterfaceNotImplemented.new "class #{name} does not implement contract #{contract}!" if breaches_contract?
          __new__(*args)
        end
      end

      def base_case
        {}
      end

      # When defining your own strategy for merging, you should define a new class that extends from
      # this class, "Strategy", and implement the method "merge_strategy" which will take care
      # of parsing the response of the batchified endpoint.
      # Should you not implement the method "merge_strategy" the exception "InterfaceNotImplemented"
      # will be raised to notify the developer of such issue.
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wor-batchifier-0.0.1 lib/wor/batchifier/strategy.rb