Module: Timeline::Helpers

Included in:
Timeline
Defined in:
lib/timeline/helpers.rb

Defined Under Namespace

Classes: DecodeException

Instance Method Summary collapse

Instance Method Details

#decode(object) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/timeline/helpers.rb', line 9

def decode(object)
  return unless object

  begin
    ::MultiJson.decode(object)
  rescue ::MultiJson::DecodeError => e
    raise DecodeException, e
  end
end

#encode(object) ⇒ Object



5
6
7
# File 'lib/timeline/helpers.rb', line 5

def encode(object)
  ::MultiJson.encode(object)
end

#get_list(options = {}) ⇒ Object



19
20
21
# File 'lib/timeline/helpers.rb', line 19

def get_list(options={})
  Timeline.redis.lrange options[:list_name], options[:start], options[:end]
end