hash_all 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/hash_all.gemspec CHANGED
@@ -11,33 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://blog.mekdigital.com"
12
12
  s.summary = %q{Wrapper for find(:all) that returns Hash}
13
13
  s.description = <<-EOF
14
-
15
- Wrapper/helper for ActiveRecord <tt>find(:all, *args)</tt>. Returns a collection of
16
- objects injected into a Hash. The attribute used as a key for the Hash should be
17
- specified as first argument. if :fetch is not specified in the arguments the whole
18
- object will be assigned as value, otherwise only the attribute spefified.
19
- You can pass in all the same arguments to this method as you can to <tt>find(:all)</tt>.
20
-
21
- Example
22
-
23
- Given the models:
24
-
25
- Feed(id: integer, state: string, name: string)
26
- Post(id: integer, feed_name: string, title: string, url: string)
27
-
28
- count the number of posts of every state. Row count is too high to use SQL JOIN.
29
-
30
- @post_per_state = {}
31
- feeds = Feed.hash_all('feed_name', :fetch => 'state')
32
- posts = Post.all(:select => 'COUNT(id), feed_name',
33
- :group => 'feed_name')
34
- posts.each do |p|
35
- @post_per_state[feeds[p.feed_name]] ||= 0
36
- @post_per_state[feeds[p.feed_name]] += p.attributes['COUNT(id)'].to_i
37
- end
38
-
39
- => {"new york"=>6, "georgia"=>11, "new mexico"=>2, ... }
40
-
14
+ Wrapper/helper for ActiveRecord find(:all, *args).\n
15
+ Returns a collection of objects injected into a Hash.
41
16
  EOF
42
17
 
43
18
  s.rubyforge_project = "hash_all"
@@ -1,3 +1,3 @@
1
1
  module HashAll
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 0
9
- version: 2.0.0
8
+ - 1
9
+ version: 2.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Emanuele Tozzato
@@ -18,7 +18,7 @@ date: 2011-03-30 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: " \n Wrapper/helper for ActiveRecord <tt>find(:all, *args)</tt>. Returns a collection of \n objects injected into a Hash. The attribute used as a key for the Hash should be \n specified as first argument. if :fetch is not specified in the arguments the whole \n object will be assigned as value, otherwise only the attribute spefified.\n You can pass in all the same arguments to this method as you can to <tt>find(:all)</tt>.\n \n Example\n \n Given the models:\n \n Feed(id: integer, state: string, name: string)\n Post(id: integer, feed_name: string, title: string, url: string)\n \n count the number of posts of every state. Row count is too high to use SQL JOIN.\n \n @post_per_state = {}\n feeds = Feed.hash_all('feed_name', :fetch => 'state')\n posts = Post.all(:select => 'COUNT(id), feed_name',\n :group => 'feed_name')\n posts.each do |p|\n @post_per_state[feeds[p.feed_name]] ||= 0 \n @post_per_state[feeds[p.feed_name]] += p.attributes['COUNT(id)'].to_i\n end\n \n => {\"new york\"=>6, \"georgia\"=>11, \"new mexico\"=>2, ... }\n \n"
21
+ description: " Wrapper/helper for ActiveRecord find(:all, *args).\n\n Returns a collection of objects injected into a Hash. \n"
22
22
  email: etozzato@gmail.com
23
23
  executables: []
24
24