nightfury 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'redis', '~> 3.0.0'
4
- gem 'redis-namespace', '~> 1.2'
3
+ gem 'redis', '~> 2.2.2'
4
+ gem 'redis-namespace', '1.0.3'
5
5
  gem 'activesupport', '~> 3.0.0'
6
6
  gem 'i18n'
7
7
  gem 'json'
@@ -3,7 +3,7 @@ module Nightfury
3
3
  class TimeSeries < Base
4
4
 
5
5
  def initialize(name, options={})
6
- super(name, options={})
6
+ super(name, options)
7
7
  init_time_series unless redis.exists(redis_key)
8
8
  end
9
9
 
@@ -21,13 +21,15 @@ module Nightfury
21
21
  data_point = ''
22
22
  if timestamp
23
23
  timestamp = timestamp.to_i
24
- data_point = redis.zrangebyscore(redis_key, timestamp, timestamp, withscores: true).last
24
+ data_point = redis.zrangebyscore(redis_key, timestamp, timestamp, withscores: true)
25
+ data_point = data_point.each_slice(2).map {|pair| pair }.last
25
26
  else
26
- data_point = redis.zrevrange(redis_key, 0, 0, withscores: true).last
27
+ data_point = redis.zrevrange(redis_key, 0, 0, withscores: true)
28
+ data_point = data_point.each_slice(2).map {|pair| pair }.last
27
29
  end
28
30
 
29
31
  return nil if data_point.nil?
30
- return nil if data_point[1] == 0.0
32
+ return nil if data_point[1] == "0"
31
33
 
32
34
  time, data = decode_data_point(data_point)
33
35
  {time => data}
@@ -74,6 +76,7 @@ module Nightfury
74
76
  end
75
77
 
76
78
  def decode_many_data_points(data_points)
79
+ data_points = data_points.each_slice(2).map {|pair| pair }
77
80
  result = {}
78
81
  data_points.each do |data_point|
79
82
  time, data = decode_data_point(data_point)
@@ -1,3 +1,3 @@
1
1
  module Nightfury
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nightfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-21 00:00:00.000000000 Z
13
+ date: 2012-12-22 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Nightfury is a reporting/analytics backend written on Redis
16
16
  email: