Sha256: ba0309c62320753c32cddcbb35a141facc9ebb755e7fac834fe677fd6ece37d8

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

require "minuteman/keys_methods"
require "minuteman/bit_operations/result"

class Minuteman
  module BitOperations
    # Public: The class to handle operations with others timespans
    #
    #   redis:      The Redis connection
    #   type:       The operation type
    #   timespan:   The timespan to be permuted
    #   source_key: The original key to do the operation
    #
    class Plain < Struct.new(:redis, :type, :timespan, :source_key)
      include KeysMethods

      def call
        events = if source_key == timespan
                   Array(source_key)
                 else
                   [source_key, timespan.key]
                 end

        key = destination_key(type, events)
        redis.bitop(type, key, events)
        Result.new(redis, key)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minuteman-0.2.0 lib/minuteman/bit_operations/plain.rb
minuteman-0.2.0.pre lib/minuteman/bit_operations/plain.rb