trackoid 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -315,6 +315,15 @@ Trackoid will correctly translate dates for you (hopefully) if you pass a date t
315
315
 
316
316
  = Revision History
317
317
 
318
+ 0.3.2 - ReaderExtender as_json sould not return the full "total" and
319
+ "hours" data. I think it's more reasonable to return just the
320
+ total number like it always was. If you have the whole structure
321
+ you need to add somewhere:
322
+
323
+ def as_json
324
+ { :total => @stat, :hourly => @stat.hourly }
325
+ end
326
+
318
327
  0.3.1 - Implemented 'to_f' into ReaderExtender to be compatible with
319
328
  ActionView::Template
320
329
  Using "%.1f" % number gave "Can't convert to float"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -52,6 +52,10 @@ module Mongoid #:nodoc:
52
52
  self
53
53
  end
54
54
 
55
+ def as_json
56
+ @total
57
+ end
58
+
55
59
  # Solution proposed by Yehuda Katz in the following Stack Overflow:
56
60
  # http://stackoverflow.com/questions/1095789/sub-classing-fixnum-in-ruby
57
61
  #
@@ -21,10 +21,14 @@ describe Mongoid::Tracking::ReaderExtender do
21
21
  num.to_f.should be_kind_of(Float)
22
22
  end
23
23
 
24
- it "as_json should return a 'total' and a 'hours' member" do
25
- json = Mongoid::Tracking::ReaderExtender.new(5, []).as_json
26
- json.should have_key("total")
27
- json.should have_key("hours")
24
+ it "as_json should not return a 'total' and a 'hours' member" do
25
+ json = Mongoid::Tracking::ReaderExtender.new(5, [1, 2, 3]).as_json
26
+ json.should == 5
27
+ end
28
+
29
+ it "hourly as_json should return an array" do
30
+ json = Mongoid::Tracking::ReaderExtender.new(5, [1, 2, 3]).hourly.as_json
31
+ json.should == [1, 2, 3]
28
32
  end
29
33
 
30
34
  it "should be able to add additional data to it" do
data/trackoid.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trackoid}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jose Miguel Perez"]
12
- s.date = %q{2011-04-16}
12
+ s.date = %q{2011-04-18}
13
13
  s.description = %q{Trackoid uses an embeddable approach to track analytics data using the poweful features of MongoDB for scalability}
14
14
  s.email = %q{josemiguel@perezruiz.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jose Miguel Perez
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-16 00:00:00 +02:00
17
+ date: 2011-04-18 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency