Class: Minuteman::BitOperations::Plain
- Inherits:
-
Struct
- Object
- Struct
- Minuteman::BitOperations::Plain
- Includes:
- KeysMethods
- Defined in:
- lib/minuteman/bit_operations/plain.rb
Overview
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
Constant Summary
Constants included from KeysMethods
KeysMethods::BIT_OPERATION_PREFIX
Instance Attribute Summary collapse
-
#redis ⇒ Object
Returns the value of attribute redis.
-
#source_key ⇒ Object
Returns the value of attribute source_key.
-
#timespan ⇒ Object
Returns the value of attribute timespan.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#redis ⇒ Object
Returns the value of attribute redis
13 14 15 |
# File 'lib/minuteman/bit_operations/plain.rb', line 13 def redis @redis end |
#source_key ⇒ Object
Returns the value of attribute source_key
13 14 15 |
# File 'lib/minuteman/bit_operations/plain.rb', line 13 def source_key @source_key end |
#timespan ⇒ Object
Returns the value of attribute timespan
13 14 15 |
# File 'lib/minuteman/bit_operations/plain.rb', line 13 def timespan @timespan end |
#type ⇒ Object
Returns the value of attribute type
13 14 15 |
# File 'lib/minuteman/bit_operations/plain.rb', line 13 def type @type end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/minuteman/bit_operations/plain.rb', line 16 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 |