Class: BitOperation
- Inherits:
-
BitAnalytics
- Object
- BitAnalytics
- BitOperation
- Includes:
- MixinContains, MixinCounts, MixinEventsMisc, RedisConnection
- Defined in:
- lib/bit_analytics.rb
Overview
You can even nest bit operations. Example:
active_2_months = BitOpAnd(
MonthEvents('active', last_month.year, last_month.month),
MonthEvents('active', now.year, now.month)
)
active_2_months = BitOpAnd(
BitOpAnd(
MonthEvents('active', last_month.year, last_month.month),
MonthEvents('active', now.year, now.month)
),
MonthEvents('active', now.year, now.month)
)
Constant Summary
Constants inherited from BitAnalytics
Instance Attribute Summary
Attributes inherited from BitAnalytics
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(op_name, *events) ⇒ BitOperation
constructor
A new instance of BitOperation.
Methods inherited from BitAnalytics
#_prefix_key, #bit_op_and, #bit_op_or, #bit_op_xor, #day_events, #delete_all_events, #delete_temporary_bitop_keys, #hour_events, #mark_event, #month_events, #week_events
Constructor Details
#initialize(op_name, *events) ⇒ BitOperation
Returns a new instance of BitOperation.
250 251 252 253 254 |
# File 'lib/bit_analytics.rb', line 250 def initialize(op_name, *events) @op_name = op_name @event_redis_keys = events.map(&:redis_key) @redis_key = 'bitanalytics_bitop_%s_%s' % [@op_name, @event_redis_keys.join('-')] end |
Instance Method Details
#execute ⇒ Object
256 257 258 |
# File 'lib/bit_analytics.rb', line 256 def execute @redis.bitop(@op_name, @redis_key, @event_redis_keys) end |