hightop 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30b66b32f29bee5e2cd663405979c99f264fcec7
4
- data.tar.gz: 7a22488634966bf9e8ab9dc98a4369c4d284915e
3
+ metadata.gz: bf96c83a04ca95ac0845fd2ac5b529448fa4ca80
4
+ data.tar.gz: 3c78e087b0b7f3e0deff1af1cbddd63c7d34dd71
5
5
  SHA512:
6
- metadata.gz: 441a692c1e4fe1ac80e0fa24a81a6395e834f9678f8fbee0b144b94940f337ab10a2e186e33ba24be8cad1603d37dad6fe1c59d1e623810413234f1710c35d44
7
- data.tar.gz: 8e612b84109a13f6c9835afa6b2c701411701f180ee365627b5a6cc482789ac13c3055f244cd3510d7c740c2700a4934efa2c50aa081ecb9d54231d5906e5988
6
+ metadata.gz: f49812c1ab004e8d83f03eff55ce001e6fceb1344e577400ab1479f4121c2dddaa1e7a6d879782b2fb4f6a0c3572984e835d2c6f6f54b4917e81fbcad0d9b7c3
7
+ data.tar.gz: c39a26e313e575df9d968778d580b3008aaca8e4089129dd2197dc511bcd17e3da0ce511f7d9f855441f6c91feb8f93c61ccdfc7ec2ad835d7a4824bf3f298a4
data/README.md CHANGED
@@ -3,19 +3,19 @@
3
3
  Super convenient group count
4
4
 
5
5
  ```ruby
6
- User.top(:gender)
6
+ Visit.top(:browser)
7
7
  ```
8
8
 
9
9
  instead of
10
10
 
11
11
  ```ruby
12
- User.group(:gender).where("gender IS NOT NULL").order("count_all DESC, gender").count
12
+ Visit.group(:browser).where("browser IS NOT NULL").order("count_all DESC, browser").count
13
13
  ```
14
14
 
15
15
  Limit the results
16
16
 
17
17
  ```ruby
18
- Visit.limit(10).top(:referring_domain)
18
+ Visit.top(:referring_domain, 10)
19
19
  ```
20
20
 
21
21
  ## Installation
@@ -1,3 +1,3 @@
1
1
  module Hightop
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/hightop.rb CHANGED
@@ -2,9 +2,9 @@ require "hightop/version"
2
2
 
3
3
  module Hightop
4
4
 
5
- def top(column)
5
+ def top(column, limit = nil)
6
6
  column = connection.quote_table_name(column)
7
- group(column).where("#{column} IS NOT NULL").order("count_all DESC, #{column}").count
7
+ group(column).where("#{column} IS NOT NULL").order("count_all DESC, #{column}").limit(limit).count
8
8
  end
9
9
 
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hightop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-11 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler