where_any 0.1.0 → 0.1.1
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/Gemfile.lock +11 -13
- data/lib/where_any/version.rb +1 -1
- data/lib/where_any.rb +14 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9757fc6639c9875f9ab31bcae335740807d9c9f63fe0765dea00b2775080efa3
|
4
|
+
data.tar.gz: 94089af17bba4a0b175b9cf23ce6d033eae826aa6c74f6f8086a891a3ed3359a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36d5778b3983606cda22f424715bfbfc324619fe275730571274a26aef99459cbffefa8994784ac1f5b97be1537cedcf357aae216eb5d0256fd895cc65950c1d
|
7
|
+
data.tar.gz: a5618216ea0d08d3e6a108bc3f8a78868ab6ecde769e7a32ee2d54503d92f3179dd2200cb1d17ab2857c79289296f1154ea5d8eeca9746e83b5df562ba880242
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
where_any (0.1.
|
4
|
+
where_any (0.1.1)
|
5
5
|
activerecord (>= 5.2.0, < 8)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
activesupport (
|
10
|
+
activemodel (7.0.4)
|
11
|
+
activesupport (= 7.0.4)
|
12
|
+
activerecord (7.0.4)
|
13
|
+
activemodel (= 7.0.4)
|
14
|
+
activesupport (= 7.0.4)
|
15
|
+
activesupport (7.0.4)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
19
19
|
tzinfo (~> 2.0)
|
20
|
-
zeitwerk (~> 2.3)
|
21
20
|
ast (2.4.2)
|
22
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.10)
|
23
22
|
diff-lcs (1.4.4)
|
24
|
-
i18n (1.
|
23
|
+
i18n (1.12.0)
|
25
24
|
concurrent-ruby (~> 1.0)
|
26
|
-
minitest (5.
|
25
|
+
minitest (5.16.3)
|
27
26
|
parallel (1.21.0)
|
28
27
|
parser (3.0.3.2)
|
29
28
|
ast (~> 2.4.1)
|
@@ -58,10 +57,9 @@ GEM
|
|
58
57
|
rubocop-rspec (2.6.0)
|
59
58
|
rubocop (~> 1.19)
|
60
59
|
ruby-progressbar (1.11.0)
|
61
|
-
tzinfo (2.0.
|
60
|
+
tzinfo (2.0.5)
|
62
61
|
concurrent-ruby (~> 1.0)
|
63
62
|
unicode-display_width (2.1.0)
|
64
|
-
zeitwerk (2.5.1)
|
65
63
|
|
66
64
|
PLATFORMS
|
67
65
|
x86_64-linux
|
data/lib/where_any/version.rb
CHANGED
data/lib/where_any.rb
CHANGED
@@ -3,6 +3,19 @@
|
|
3
3
|
require_relative 'where_any/version'
|
4
4
|
|
5
5
|
module WhereAny
|
6
|
+
# @param name [String]
|
7
|
+
# @return [ActiveRecord::Type::Value]
|
8
|
+
def array_type_for_attribute(name)
|
9
|
+
element_type = type_for_attribute(name)
|
10
|
+
|
11
|
+
if (type = element_type.type)
|
12
|
+
ActiveRecord::Type.lookup(type, array: true)
|
13
|
+
else
|
14
|
+
# For unknown types (e.g. from projected columns), use a generic array type.
|
15
|
+
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array.new(element_type)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
6
19
|
# @param name [String]
|
7
20
|
# @param value [Object]
|
8
21
|
# @return [Arel::Nodes::Node]
|
@@ -17,8 +30,7 @@ module WhereAny
|
|
17
30
|
# @param value [Object]
|
18
31
|
# @return [Arel::Nodes::Node]
|
19
32
|
def bind_array(name, value)
|
20
|
-
|
21
|
-
attribute_type = ActiveRecord::Type.lookup(element_type.type, array: true)
|
33
|
+
attribute_type = array_type_for_attribute(name)
|
22
34
|
query_attribute = ActiveRecord::Relation::QueryAttribute.new(name.to_s, value, attribute_type)
|
23
35
|
|
24
36
|
Arel::Nodes::BindParam.new(query_attribute)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: where_any
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minty Fresh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.3.7
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Postgres ANY() and ALL() expressions for ActiveRecord.
|