Class: Minuteman::BitOperations::Operation

Inherits:
Struct
  • Object
show all
Defined in:
lib/minuteman/bit_operations/operation.rb

Overview

Public: Handles the operations between two timespans

redis:      The Redis connection
type:       The operation type
timespan:   One of the timespans to be permuted
other:      The other timespan to be permuted

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#otherObject

Returns the value of attribute other

Returns:

  • (Object)

    the current value of other



13
14
15
# File 'lib/minuteman/bit_operations/operation.rb', line 13

def other
  @other
end

#redisObject

Returns the value of attribute redis

Returns:

  • (Object)

    the current value of redis



13
14
15
# File 'lib/minuteman/bit_operations/operation.rb', line 13

def redis
  @redis
end

#timespanObject

Returns the value of attribute timespan

Returns:

  • (Object)

    the current value of timespan



13
14
15
# File 'lib/minuteman/bit_operations/operation.rb', line 13

def timespan
  @timespan
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



13
14
15
# File 'lib/minuteman/bit_operations/operation.rb', line 13

def type
  @type
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
# File 'lib/minuteman/bit_operations/operation.rb', line 14

def call
  if type == "MINUS" && operable?
    return timespan ^ (timespan & other)
  end

  klass.new(redis, type, other, timespan.key).call
end