hightop 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -12
- data/LICENSE.txt +1 -1
- data/README.md +9 -0
- data/lib/hightop/enumerable.rb +5 -9
- data/lib/hightop/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 340c609cb491de09f5c69f80b3e237126c081a8167565c78d6f28cac692cc34b
|
4
|
+
data.tar.gz: 0aa4d15e3ac6503a73f664602d0d07f1a0e956202f93411ec51d663dcca9b2ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31bcc5dcc655886f5dad2ebe27f33a7f56702b0503883bac779a944b502dc9bf1f27694c1eb83e4d36ca908fbb1bbe5e9b09706b5536f1ba53616e555204c579
|
7
|
+
data.tar.gz: 1e4d59093c22c49d3166368d8b23386ca7366dd9fc1b31e813e9df81bdd5d3b3e7d87ece4d36bf6b94deef69d2cd093927c0d9eeb62582fd357feed0c381564d
|
data/CHANGELOG.md
CHANGED
@@ -1,49 +1,54 @@
|
|
1
|
-
## 0.2.
|
1
|
+
## 0.2.3 (2020-06-18)
|
2
|
+
|
3
|
+
- Dropped support for Rails 4.2 and Ruby 2.3
|
4
|
+
- Fixed deprecation warning in Ruby 2.7
|
5
|
+
|
6
|
+
## 0.2.2 (2019-08-12)
|
2
7
|
|
3
8
|
- Added support for Mongoid
|
4
9
|
|
5
|
-
## 0.2.1
|
10
|
+
## 0.2.1 (2019-08-04)
|
6
11
|
|
7
12
|
- Added support for arrays and hashes
|
8
13
|
|
9
|
-
## 0.2.0
|
14
|
+
## 0.2.0 (2017-03-19)
|
10
15
|
|
11
16
|
- Use keyword arguments
|
12
17
|
|
13
|
-
## 0.1.4
|
18
|
+
## 0.1.4 (2016-02-04)
|
14
19
|
|
15
20
|
- Added `distinct` option to replace `uniq`
|
16
21
|
|
17
|
-
## 0.1.3
|
22
|
+
## 0.1.3 (2015-06-18)
|
18
23
|
|
19
24
|
- Fixed `min` option with `uniq`
|
20
25
|
|
21
|
-
## 0.1.2
|
26
|
+
## 0.1.2 (2014-11-05)
|
22
27
|
|
23
28
|
- Added `min` option
|
24
29
|
|
25
|
-
## 0.1.1
|
30
|
+
## 0.1.1 (2014-07-02)
|
26
31
|
|
27
32
|
- Added `uniq` option
|
28
33
|
- Fixed `Model.limit(n).top`
|
29
34
|
|
30
|
-
## 0.1.0
|
35
|
+
## 0.1.0 (2014-06-11)
|
31
36
|
|
32
37
|
- No changes, just bump
|
33
38
|
|
34
|
-
## 0.0.4
|
39
|
+
## 0.0.4 (2014-06-11)
|
35
40
|
|
36
41
|
- Added support for multiple groups
|
37
42
|
- Added `nil` option
|
38
43
|
|
39
|
-
## 0.0.3
|
44
|
+
## 0.0.3 (2014-06-11)
|
40
45
|
|
41
46
|
- Fixed escaping
|
42
47
|
|
43
|
-
## 0.0.2
|
48
|
+
## 0.0.2 (2014-05-29)
|
44
49
|
|
45
50
|
- Added `limit` parameter
|
46
51
|
|
47
|
-
## 0.0.1
|
52
|
+
## 0.0.1 (2014-05-11)
|
48
53
|
|
49
54
|
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -118,3 +118,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
118
118
|
- Fix bugs and [submit pull requests](https://github.com/ankane/hightop/pulls)
|
119
119
|
- Write, clarify, or fix documentation
|
120
120
|
- Suggest or add new features
|
121
|
+
|
122
|
+
To get started with development and testing:
|
123
|
+
|
124
|
+
```sh
|
125
|
+
git clone https://github.com/ankane/hightop.git
|
126
|
+
cd hightop
|
127
|
+
bundle install
|
128
|
+
bundle exec rake test
|
129
|
+
```
|
data/lib/hightop/enumerable.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
module Enumerable
|
2
|
-
def top(*args, &block)
|
2
|
+
def top(*args, **options, &block)
|
3
3
|
if block || !(respond_to?(:scoping) || respond_to?(:with_scope))
|
4
|
-
|
5
|
-
|
6
|
-
options = limit
|
7
|
-
limit = nil
|
8
|
-
end
|
9
|
-
options ||= {}
|
4
|
+
# TODO raise error if too many arguments
|
5
|
+
limit = args[0]
|
10
6
|
min = options[:min]
|
11
7
|
|
12
8
|
counts = Hash.new(0)
|
@@ -20,9 +16,9 @@ module Enumerable
|
|
20
16
|
arr = arr[0...limit] if limit
|
21
17
|
Hash[arr]
|
22
18
|
elsif respond_to?(:scoping)
|
23
|
-
scoping { @klass.send(:top, *args, &block) }
|
19
|
+
scoping { @klass.send(:top, *args, **options, &block) }
|
24
20
|
else
|
25
|
-
with_scope(self) { klass.send(:top, *args, &block) }
|
21
|
+
with_scope(self) { klass.send(:top, *args, **options, &block) }
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
data/lib/hightop/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +106,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
109
|
+
version: '2.4'
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
116
|
+
rubygems_version: 3.1.2
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A nice shortcut for group count queries
|