calculations_by_time_range 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Michael Nikitochkin
1
+ Copyright (c) 2009 JetThoughts
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,21 +1,35 @@
1
- = calculations_by_time_range
1
+ = Calculations By Time Range
2
2
 
3
3
  Add new methods for ActiveRecord to get agregate values by time range.
4
4
 
5
- Usage:
5
+ == Install & use
6
6
 
7
- Example you have model User with attributes:
8
- updated_at
9
- created_at
10
- name
11
- age
7
+ Install the gem from rubyforge:
12
8
 
13
- You could count how many people register by day:
14
- User.counts_by_day
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
- Found sum of ages by month in field updated_at:
18
- User.sums_by :month, 'age', 'updated_at'
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. See LICENSE for details.
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
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.1"
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-30}
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.1
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-30 00:00:00 +02:00
12
+ date: 2010-01-31 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency