hightop 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -13
- data/lib/hightop/enumerable.rb +1 -1
- data/lib/hightop/utils.rb +2 -2
- 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: 1e2aa6433ef6bce3eeb12610eaa528a9ecd9b41d5efdcfb6483b7ea024937c81
|
4
|
+
data.tar.gz: dda7fd42d30a5eb6e02a4dc30cf92cf9a2a5893003805aceba07ead334800280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262218e9bb2753e7519459d6b63882ae948b599b14d28f9042af9bf379d9ca516e47cd1202c001df92806cc29fa2817313099a46cf452ba5a5b6207a131a4102
|
7
|
+
data.tar.gz: d7015662042f38e090b4dc0c330acacc6050ce68243c13d0967451296c2fe04698029d97258face412e691f9c244986b645797131f00cd3284d0fc641e07145e
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Visit.top(:browser)
|
|
13
13
|
|
14
14
|
Works with Active Record, Mongoid, arrays and hashes
|
15
15
|
|
16
|
-
[![Build Status](https://github.com/ankane/hightop/workflows/build/badge.svg
|
16
|
+
[![Build Status](https://github.com/ankane/hightop/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/hightop/actions)
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -93,18 +93,6 @@ Min count
|
|
93
93
|
["up", "up", "down"].top(min: 2)
|
94
94
|
```
|
95
95
|
|
96
|
-
## Upgrading
|
97
|
-
|
98
|
-
### 0.3.0
|
99
|
-
|
100
|
-
Hightop 0.3.0 protects against unsafe input by default. For non-attribute arguments, use:
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
Visit.top(Arel.sql(known_safe_value))
|
104
|
-
```
|
105
|
-
|
106
|
-
Also, the `uniq` option has been removed. Use `distinct` instead.
|
107
|
-
|
108
96
|
## History
|
109
97
|
|
110
98
|
View the [changelog](https://github.com/ankane/hightop/blob/master/CHANGELOG.md)
|
data/lib/hightop/enumerable.rb
CHANGED
@@ -17,7 +17,7 @@ module Enumerable
|
|
17
17
|
arr = arr[0...limit] if limit
|
18
18
|
Hash[arr]
|
19
19
|
elsif respond_to?(:scoping)
|
20
|
-
scoping {
|
20
|
+
scoping { klass.send(:top, *args, **options, &block) }
|
21
21
|
else
|
22
22
|
with_scope(self) { klass.send(:top, *args, **options, &block) }
|
23
23
|
end
|
data/lib/hightop/utils.rb
CHANGED
@@ -7,7 +7,7 @@ module Hightop
|
|
7
7
|
def validate_column(column)
|
8
8
|
unless column.is_a?(Symbol) || column.is_a?(Arel::Nodes::SqlLiteral)
|
9
9
|
column = column.to_s
|
10
|
-
unless /\A\w+(\.\w+)?\z/i.match(column)
|
10
|
+
unless /\A\w+(\.\w+)?\z/i.match?(column)
|
11
11
|
raise ActiveRecord::UnknownAttributeReference, "Query method called with non-attribute argument(s): #{column.inspect}. Use Arel.sql() for known-safe values."
|
12
12
|
end
|
13
13
|
end
|
@@ -18,7 +18,7 @@ module Hightop
|
|
18
18
|
def resolve_column(relation, column)
|
19
19
|
node = relation.send(:relation).send(:arel_columns, [column]).first
|
20
20
|
node = Arel::Nodes::SqlLiteral.new(node) if node.is_a?(String)
|
21
|
-
relation.
|
21
|
+
relation.connection_pool.with_connection { |c| c.visitor.accept(node, Arel::Collectors::SQLString.new).value }
|
22
22
|
end
|
23
23
|
end
|
24
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.
|
4
|
+
version: 0.5.0
|
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: 2024-10-08 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: '7'
|
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: '7'
|
27
27
|
description:
|
28
28
|
email: andrew@ankane.org
|
29
29
|
executables: []
|
@@ -51,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3'
|
54
|
+
version: '3.1'
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.5.16
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: A nice shortcut for group count queries
|