Class: BucketCake::Base::Realtime

Inherits:
BucketCake::Base show all
Includes:
TimeHelper
Defined in:
lib/bucket_cake/base.rb

Direct Known Subclasses

Realtime::Clicks, Realtime::Conversions

Constant Summary collapse

DEFAULT_LOOKBACK =
24.hours
CURSOR_REGEX =
%r{\A\w+/\d{4}/\d{2}/\d{2}/\d{4}\.gz\z}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TimeHelper

#assert_time, #hour_cursor, #hour_keys, #minute_cursor

Methods inherited from BucketCake::Base

#items

Constructor Details

#initialize(cursor) ⇒ Realtime

Returns a new instance of Realtime.



71
72
73
74
# File 'lib/bucket_cake/base.rb', line 71

def initialize(cursor)
  raise 'Invalid cursor format!' unless cursor.nil? || cursor =~ CURSOR_REGEX
  @cursor = cursor || default_cursor
end

Instance Attribute Details

#cursorObject (readonly)

Returns the value of attribute cursor.



69
70
71
# File 'lib/bucket_cake/base.rb', line 69

def cursor
  @cursor
end

Instance Method Details

#filesObject



76
77
78
79
80
# File 'lib/bucket_cake/base.rb', line 76

def files
  @keys = load_keys
  @cursor = keys.last unless keys.empty?
  super
end