calculations_by_time_range 0.2.1 → 0.2.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/LICENSE +1 -1
- data/README.rdoc +26 -12
- data/VERSION +1 -1
- data/calculations_by_time_range.gemspec +2 -2
- metadata +2 -2
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,21 +1,35 @@
|
|
1
|
-
=
|
1
|
+
= Calculations By Time Range
|
2
2
|
|
3
3
|
Add new methods for ActiveRecord to get agregate values by time range.
|
4
4
|
|
5
|
-
|
5
|
+
== Install & use
|
6
6
|
|
7
|
-
|
8
|
-
updated_at
|
9
|
-
created_at
|
10
|
-
name
|
11
|
-
age
|
7
|
+
Install the gem from rubyforge:
|
12
8
|
|
13
|
-
|
14
|
-
|
9
|
+
sudo gem install calculations_by_time_range
|
10
|
+
|
11
|
+
Now just set it as a dependency in your project and you are ready to go.
|
12
|
+
|
13
|
+
You can also install this as a plugin:
|
14
|
+
|
15
|
+
script/plugin install git://github.com/miry/calculations_by_time_range.git
|
15
16
|
|
17
|
+
See below for usage examples.
|
18
|
+
|
19
|
+
== Usage
|
20
|
+
|
21
|
+
# We have the following model
|
22
|
+
User(id: integer, created_at: datetime, updated_at: datetime, username: string, age: integer)
|
23
|
+
|
24
|
+
# CalculationsByTimeRange gives you a bunch of named scopes for free:
|
25
|
+
User.counts_by_day
|
26
|
+
User.counts_by(:day)
|
27
|
+
User.counts_by(:day, '*', 'updated_at')
|
28
|
+
User.sums_by(:week, 'age')
|
16
29
|
|
17
|
-
|
18
|
-
|
30
|
+
== Examples with Searchlogic and scopes
|
31
|
+
|
32
|
+
User.created_at_gt(1.day.ago).counts_by_hours
|
19
33
|
|
20
34
|
== Note on Patches/Pull Requests
|
21
35
|
|
@@ -29,4 +43,4 @@ Found sum of ages by month in field updated_at:
|
|
29
43
|
|
30
44
|
== Copyright
|
31
45
|
|
32
|
-
Copyright (c) 2010 Michael Nikitochkin.
|
46
|
+
Copyright (c) 2010 {Michael Nikitochkin of JetThoughts}[http://www.jetthoughts.com], released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{calculations_by_time_range}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Nikitochkin"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-31}
|
13
13
|
s.description = %q{A methods for calculates agregate values by time range.}
|
14
14
|
s.email = %q{miry.sof@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calculations_by_time_range
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Nikitochkin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-31 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|