Sha256: 29ac4cf205265f27d50175bd231a2a15f0fd6a3a9d08830e836421ba78447625

Contents?: true

Size: 389 Bytes

Versions: 3

Compression:

Stored size: 389 Bytes

Contents

module Jamnagar
  module Utilities
    class PopularityIncrementor
      def initialize(store)
        @store = store
      end

      def increment(id)
        @store.find_and_modify(update_params(id))
      end
    private
      def update_params(id)
        {
          :query => {"_id" => id},
          :update => {"$inc" => {"popularity" => 1}}
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jamnagar-1.3.9.1 lib/jamnagar/utilities/popularity_incrementor.rb
jamnagar-1.3.9 lib/jamnagar/utilities/popularity_incrementor.rb
jamnagar-1.3.8 lib/jamnagar/utilities/popularity_incrementor.rb