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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5cecd8f175eb80cd97c4aa38d38113de436b2c437bd60d97a72585b994fea97
4
- data.tar.gz: 16272ba486c5ecafd05e26b211ba373f0446173bbc26a32d2644b4d069d1ea79
3
+ metadata.gz: 1e2aa6433ef6bce3eeb12610eaa528a9ecd9b41d5efdcfb6483b7ea024937c81
4
+ data.tar.gz: dda7fd42d30a5eb6e02a4dc30cf92cf9a2a5893003805aceba07ead334800280
5
5
  SHA512:
6
- metadata.gz: 1c7b2abd51dc28b295fd7d039d1127e7d2a4e855f5204564c0f0bd54c1522b9d707429f56214a3a457e3c0d0e3bcfa6046122e53356fb4d24679935dfa0cb856
7
- data.tar.gz: 4e33403bb495306b78ebe1d5ea97d15defd6e3952dcc97e346ad6e45a933795577cb4dde81fe01e1b73fa2c41da3cb3f6735972638b8b6011b019275ad9b5f36
6
+ metadata.gz: 262218e9bb2753e7519459d6b63882ae948b599b14d28f9042af9bf379d9ca516e47cd1202c001df92806cc29fa2817313099a46cf452ba5a5b6207a131a4102
7
+ data.tar.gz: d7015662042f38e090b4dc0c330acacc6050ce68243c13d0967451296c2fe04698029d97258face412e691f9c244986b645797131f00cd3284d0fc641e07145e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.5.0 (2024-10-07)
2
+
3
+ - Fixed connection leasing for Active Record 7.2+
4
+ - Dropped support for Active Record < 7 and Ruby < 3.1
5
+
1
6
  ## 0.4.0 (2023-07-02)
2
7
 
3
8
  - Dropped support for Active Record < 6.1 and Ruby < 3
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2023 Andrew Kane
1
+ Copyright (c) 2014-2024 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
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?branch=master)](https://github.com/ankane/hightop/actions)
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)
@@ -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 { @klass.send(:top, *args, **options, &block) }
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.connection.visitor.accept(node, Arel::Collectors::SQLString.new).value
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
@@ -1,3 +1,3 @@
1
1
  module Hightop
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  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.4.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: 2023-07-02 00:00:00.000000000 Z
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: '6.1'
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: '6.1'
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.4.10
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