mobility 0.4.0 → 0.4.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +3 -3
- data/README.md +1 -1
- data/lib/mobility/backends/active_record/container/query_methods.rb +3 -3
- data/lib/mobility/backends/active_record/hstore/query_methods.rb +1 -1
- data/lib/mobility/backends/active_record/jsonb/query_methods.rb +2 -2
- data/lib/mobility/backends/active_record/pg_query_methods.rb +4 -4
- data/lib/mobility/backends/sequel/container/query_methods.rb +2 -2
- data/lib/mobility/backends/sequel/hstore/query_methods.rb +1 -1
- data/lib/mobility/backends/sequel/jsonb/query_methods.rb +2 -2
- data/lib/mobility/backends/sequel/pg_query_methods.rb +5 -5
- data/lib/mobility/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b4475c1c4828150f79f535dd8974561e2d5b819
|
4
|
+
data.tar.gz: 03ce38c5557fb60468f07b3eae5b8f797625c798
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a19d72816a4c76d79a6e46a7d5a5f3eb63e6620a38a0bd29f1cc0dd7ed2361dbae12b3678afde7277d29397d8de1aed4788d99718edbea5139b0c3b0899a754
|
7
|
+
data.tar.gz: d9d15056bd2bfdc5238e5bb4003ae3352df6581175abd6d899546064bda8e1f41f3377124ea5309df78715fdb4d3e6262624ccdccf9c8203d94e84c3a19f86d3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## 0.4
|
4
4
|
|
5
|
+
### 0.4.1 (January 29, 2018)
|
6
|
+
* Use element operator instead of contains for jsonb query8ing
|
7
|
+
([#159](https://github.com/shioyama/mobility/pull/159))
|
8
|
+
|
5
9
|
### 0.4.0 (January 24, 2018)
|
6
10
|
* Add new jsonb Container backend
|
7
11
|
([#157](https://github.com/shioyama/mobility/pull/157))
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mobility (0.4.0
|
4
|
+
mobility (0.4.0)
|
5
5
|
i18n (>= 0.6.10, < 0.10)
|
6
6
|
request_store (~> 1.0)
|
7
7
|
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
guard (~> 2.1)
|
62
62
|
guard-compat (~> 1.1)
|
63
63
|
rspec (>= 2.99.0, < 4.0)
|
64
|
-
i18n (0.9.
|
64
|
+
i18n (0.9.3)
|
65
65
|
concurrent-ruby (~> 1.0)
|
66
66
|
listen (3.1.5)
|
67
67
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -73,7 +73,7 @@ GEM
|
|
73
73
|
lumberjack (1.0.12)
|
74
74
|
method_source (0.9.0)
|
75
75
|
mini_portile2 (2.3.0)
|
76
|
-
minitest (5.11.
|
76
|
+
minitest (5.11.3)
|
77
77
|
mysql2 (0.4.10)
|
78
78
|
nenv (0.3.0)
|
79
79
|
nokogiri (1.8.1)
|
data/README.md
CHANGED
@@ -14,10 +14,10 @@ module Mobility
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def
|
18
|
-
build_infix(:'
|
17
|
+
def matches(key, value, locale)
|
18
|
+
build_infix(:'->',
|
19
19
|
build_infix(:'->', column, quote(locale)),
|
20
|
-
quote(
|
20
|
+
quote(key)).eq(quote(value.to_json))
|
21
21
|
end
|
22
22
|
|
23
23
|
def has_locale(key, locale)
|
@@ -8,8 +8,8 @@ module Mobility
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
def
|
12
|
-
build_infix(:'
|
11
|
+
def matches(key, value, locale)
|
12
|
+
build_infix(:'->', arel_table[key], quote(locale)).eq(quote(value.to_json))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -4,7 +4,7 @@ module Mobility
|
|
4
4
|
=begin
|
5
5
|
|
6
6
|
Defines query methods for Postgres backends. Including class must define a
|
7
|
-
single method, +
|
7
|
+
single method, +matches+, which accepts a column, value and locale to
|
8
8
|
match, and returns an Arel node.
|
9
9
|
|
10
10
|
This module avoids 99% duplication between hstore and jsonb backend querying
|
@@ -70,7 +70,7 @@ code.
|
|
70
70
|
Array.wrap(values).map { |value|
|
71
71
|
value.nil? ?
|
72
72
|
has_locale(key, locale).not :
|
73
|
-
|
73
|
+
matches(key, value, locale)
|
74
74
|
}.inject(&:or)
|
75
75
|
}.inject(&:and)
|
76
76
|
end
|
@@ -87,14 +87,14 @@ code.
|
|
87
87
|
values = opts.delete(key)
|
88
88
|
|
89
89
|
Array.wrap(values).map { |value|
|
90
|
-
|
90
|
+
matches(key, value, locale).not
|
91
91
|
}.inject(has_locale(key, locale), &:and)
|
92
92
|
}.inject(&:and)
|
93
93
|
end
|
94
94
|
|
95
95
|
private
|
96
96
|
|
97
|
-
def
|
97
|
+
def matches(_key, _value, _locale)
|
98
98
|
raise NotImplementedError
|
99
99
|
end
|
100
100
|
|
@@ -25,8 +25,8 @@ module Mobility
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def
|
29
|
-
build_op(column_name)[locale]
|
28
|
+
def matches(key, value, locale)
|
29
|
+
build_op(column_name)[locale][key.to_s] =~ value.to_json
|
30
30
|
end
|
31
31
|
|
32
32
|
def has_locale(key, locale)
|
@@ -6,14 +6,14 @@ module Mobility
|
|
6
6
|
Defines query methods for Postgres backends. Including class must define two
|
7
7
|
private methods:
|
8
8
|
|
9
|
-
- a private method +
|
9
|
+
- a private method +matches+ which takes a key (column name), value and
|
10
10
|
locale and returns an SQL expression, and checks that the column has the
|
11
11
|
specified value in the specified locale
|
12
12
|
- a private method +has_locale+ which takes a key (column name) and locale, and
|
13
13
|
returns an SQL expression which checks that the column has a value in the
|
14
14
|
locale
|
15
15
|
|
16
|
-
(The +
|
16
|
+
(The +matches+ method is implemented slightly differently for hstore and
|
17
17
|
jsonb columns.)
|
18
18
|
|
19
19
|
=end
|
@@ -66,13 +66,13 @@ jsonb columns.)
|
|
66
66
|
locale = Mobility.locale.to_s
|
67
67
|
|
68
68
|
if invert
|
69
|
-
has_locale(key, locale) & ~
|
69
|
+
has_locale(key, locale) & ~matches(key, value, locale)
|
70
70
|
else
|
71
|
-
value.nil? ? ~has_locale(key, locale) :
|
71
|
+
value.nil? ? ~has_locale(key, locale) : matches(key, value, locale)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def matches(_key, _value, _locale)
|
76
76
|
raise NotImplementedError
|
77
77
|
end
|
78
78
|
|
data/lib/mobility/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
eGDROPZoL5RXwiOnRbexxa7dcAxMrDfGB/hpiunIPWPsi4n5P7K/6OO/sGVMl9xv
|
31
31
|
SZBPXjzrHdyOFLBYXB+PG7s3F/4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-01-
|
33
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: request_store
|
metadata.gz.sig
CHANGED
Binary file
|