mobility 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +3 -58
- data/README.md +1 -1
- data/lib/mobility/backends/active_record/column/query_methods.rb +0 -6
- data/lib/mobility/backends/active_record/key_value/query_methods.rb +0 -6
- data/lib/mobility/backends/active_record/query_methods.rb +6 -0
- data/lib/mobility/backends/active_record/table/query_methods.rb +0 -6
- data/lib/mobility/backends/sequel/column/query_methods.rb +0 -6
- data/lib/mobility/backends/sequel/container/query_methods.rb +1 -9
- data/lib/mobility/backends/sequel/hstore/query_methods.rb +1 -14
- data/lib/mobility/backends/sequel/jsonb/query_methods.rb +0 -13
- data/lib/mobility/backends/sequel/key_value/query_methods.rb +0 -6
- data/lib/mobility/backends/sequel/pg_query_methods.rb +4 -0
- data/lib/mobility/backends/sequel/query_methods.rb +6 -0
- data/lib/mobility/backends/sequel/table/query_methods.rb +0 -6
- data/lib/mobility/version.rb +1 -1
- metadata +1 -1
- 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: 940b49f8c3a48cc006aa2a981627065adcc7a645
|
4
|
+
data.tar.gz: 75aef5224d15662c0297f5bf0665d496d08c2118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e0c11a3349d6761afe95d858a9c85887ddb442713076a6f064ab59bcb6e957646bbaac68c3b0d8b9715e54af5dca03b1332cc55d06defaa62e8406e5a11778
|
7
|
+
data.tar.gz: cff9fff5d014f38c90a81ade0ce87f8d007c02dcfd7090a61c73e0472c939c95fe05048256b7d09a3676a8cd9648d618db0a2ba14abc3ab723cbeb5d9b8040b3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
## 0.4
|
4
4
|
|
5
|
+
### 0.4.2 (January 29, 2018)
|
6
|
+
* Refactor find_by for translated attributes
|
7
|
+
([#160](https://github.com/shioyama/mobility/pull/160))
|
8
|
+
|
5
9
|
### 0.4.1 (January 29, 2018)
|
6
|
-
* Use element operator instead of contains for jsonb
|
10
|
+
* Use element operator instead of contains for jsonb querying
|
7
11
|
([#159](https://github.com/shioyama/mobility/pull/159))
|
8
12
|
|
9
13
|
### 0.4.0 (January 24, 2018)
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mobility (0.4.
|
4
|
+
mobility (0.4.1)
|
5
5
|
i18n (>= 0.6.10, < 0.10)
|
6
6
|
request_store (~> 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (5.2.0.beta2)
|
12
|
-
actionview (= 5.2.0.beta2)
|
13
|
-
activesupport (= 5.2.0.beta2)
|
14
|
-
rack (~> 2.0)
|
15
|
-
rack-test (>= 0.6.3)
|
16
|
-
rails-dom-testing (~> 2.0)
|
17
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
-
actionview (5.2.0.beta2)
|
19
|
-
activesupport (= 5.2.0.beta2)
|
20
|
-
builder (~> 3.1)
|
21
|
-
erubi (~> 1.4)
|
22
|
-
rails-dom-testing (~> 2.0)
|
23
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
24
|
-
activemodel (5.2.0.beta2)
|
25
|
-
activesupport (= 5.2.0.beta2)
|
26
|
-
activerecord (5.2.0.beta2)
|
27
|
-
activemodel (= 5.2.0.beta2)
|
28
|
-
activesupport (= 5.2.0.beta2)
|
29
|
-
arel (>= 9.0)
|
30
|
-
activesupport (5.2.0.beta2)
|
31
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
32
|
-
i18n (~> 0.7)
|
33
|
-
minitest (~> 5.1)
|
34
|
-
tzinfo (~> 1.1)
|
35
|
-
arel (9.0.0)
|
36
11
|
benchmark-ips (2.7.2)
|
37
|
-
builder (3.2.3)
|
38
12
|
byebug (9.1.0)
|
39
13
|
coderay (1.1.2)
|
40
14
|
concurrent-ruby (1.0.5)
|
41
|
-
crass (1.0.3)
|
42
15
|
database_cleaner (1.6.2)
|
43
16
|
diff-lcs (1.3)
|
44
|
-
erubi (1.7.0)
|
45
17
|
ffi (1.9.18)
|
46
18
|
formatador (0.2.5)
|
47
|
-
generator_spec (0.9.4)
|
48
|
-
activesupport (>= 3.0.0)
|
49
|
-
railties (>= 3.0.0)
|
50
19
|
guard (2.14.2)
|
51
20
|
formatador (>= 0.2.4)
|
52
21
|
listen (>= 2.7, < 4.0)
|
@@ -67,17 +36,10 @@ GEM
|
|
67
36
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
68
37
|
rb-inotify (~> 0.9, >= 0.9.7)
|
69
38
|
ruby_dep (~> 1.2)
|
70
|
-
loofah (2.1.1)
|
71
|
-
crass (~> 1.0.2)
|
72
|
-
nokogiri (>= 1.5.9)
|
73
39
|
lumberjack (1.0.12)
|
74
40
|
method_source (0.9.0)
|
75
|
-
mini_portile2 (2.3.0)
|
76
|
-
minitest (5.11.3)
|
77
41
|
mysql2 (0.4.10)
|
78
42
|
nenv (0.3.0)
|
79
|
-
nokogiri (1.8.1)
|
80
|
-
mini_portile2 (~> 2.3.0)
|
81
43
|
notiffany (0.1.1)
|
82
44
|
nenv (~> 0.1)
|
83
45
|
shellany (~> 0.0)
|
@@ -89,19 +51,6 @@ GEM
|
|
89
51
|
byebug (~> 9.1)
|
90
52
|
pry (~> 0.10)
|
91
53
|
rack (2.0.3)
|
92
|
-
rack-test (0.8.2)
|
93
|
-
rack (>= 1.0, < 3)
|
94
|
-
rails-dom-testing (2.0.3)
|
95
|
-
activesupport (>= 4.2.0)
|
96
|
-
nokogiri (>= 1.6)
|
97
|
-
rails-html-sanitizer (1.0.3)
|
98
|
-
loofah (~> 2.0)
|
99
|
-
railties (5.2.0.beta2)
|
100
|
-
actionpack (= 5.2.0.beta2)
|
101
|
-
activesupport (= 5.2.0.beta2)
|
102
|
-
method_source
|
103
|
-
rake (>= 0.8.7)
|
104
|
-
thor (>= 0.18.1, < 2.0)
|
105
54
|
rake (12.3.0)
|
106
55
|
rb-fsevent (0.10.2)
|
107
56
|
rb-inotify (0.9.10)
|
@@ -122,31 +71,27 @@ GEM
|
|
122
71
|
rspec-support (~> 3.7.0)
|
123
72
|
rspec-support (3.7.0)
|
124
73
|
ruby_dep (1.5.0)
|
74
|
+
sequel (5.4.0)
|
125
75
|
shellany (0.0.1)
|
126
76
|
sqlite3 (1.3.13)
|
127
77
|
thor (0.20.0)
|
128
|
-
thread_safe (0.3.6)
|
129
|
-
tzinfo (1.2.4)
|
130
|
-
thread_safe (~> 0.1)
|
131
78
|
yard (0.9.12)
|
132
79
|
|
133
80
|
PLATFORMS
|
134
81
|
ruby
|
135
82
|
|
136
83
|
DEPENDENCIES
|
137
|
-
activerecord (>= 5.2.0.beta1, < 5.3)
|
138
84
|
benchmark-ips
|
139
85
|
bundler (~> 1.12)
|
140
86
|
database_cleaner (~> 1.5, >= 1.5.3)
|
141
|
-
generator_spec (~> 0.9.4)
|
142
87
|
guard-rspec
|
143
88
|
mobility!
|
144
89
|
mysql2 (~> 0.4.9)
|
145
90
|
pg (< 1.0)
|
146
91
|
pry-byebug
|
147
|
-
railties (>= 5.2.0.beta1, < 5.3)
|
148
92
|
rake (~> 12, >= 12.2.1)
|
149
93
|
rspec (~> 3.0)
|
94
|
+
sequel (>= 5.0.0, < 6.0.0)
|
150
95
|
sqlite3
|
151
96
|
yard (~> 0.9.0)
|
152
97
|
|
data/README.md
CHANGED
@@ -10,12 +10,6 @@ module Mobility
|
|
10
10
|
define_method :where! do |opts, *rest|
|
11
11
|
super(q.convert_opts(opts), *rest)
|
12
12
|
end
|
13
|
-
|
14
|
-
attributes.each do |attribute|
|
15
|
-
define_method :"find_by_#{attribute}" do |value|
|
16
|
-
find_by(Column.column_name_for(attribute) => value)
|
17
|
-
end
|
18
|
-
end
|
19
13
|
end
|
20
14
|
|
21
15
|
def extended(relation)
|
@@ -9,12 +9,6 @@ module Mobility
|
|
9
9
|
|
10
10
|
define_join_method(association_name, class_name)
|
11
11
|
define_query_methods(association_name)
|
12
|
-
|
13
|
-
attributes.each do |attribute|
|
14
|
-
define_method :"find_by_#{attribute}" do |value|
|
15
|
-
find_by(attribute.to_sym => value)
|
16
|
-
end
|
17
|
-
end
|
18
12
|
end
|
19
13
|
|
20
14
|
def extended(relation)
|
@@ -11,6 +11,12 @@ models. For details see backend-specific subclasses.
|
|
11
11
|
# @param [Array<String>] attributes Translated attributes
|
12
12
|
def initialize(attributes, _)
|
13
13
|
@attributes = attributes
|
14
|
+
|
15
|
+
attributes.each do |attribute|
|
16
|
+
define_method :"find_by_#{attribute}" do |value|
|
17
|
+
find_by(attribute.to_sym => value)
|
18
|
+
end
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
# @param [ActiveRecord::Relation] relation Relation being extended
|
@@ -11,12 +11,6 @@ module Mobility
|
|
11
11
|
|
12
12
|
define_join_method(association_name, translation_class, **options)
|
13
13
|
define_query_methods(association_name, translation_class, **options)
|
14
|
-
|
15
|
-
attributes.each do |attribute|
|
16
|
-
define_method :"find_by_#{attribute}" do |value|
|
17
|
-
find_by(attribute.to_sym => value)
|
18
|
-
end
|
19
|
-
end
|
20
14
|
end
|
21
15
|
|
22
16
|
def extended(relation)
|
@@ -11,16 +11,8 @@ module Mobility
|
|
11
11
|
|
12
12
|
def initialize(attributes, options)
|
13
13
|
super
|
14
|
-
|
15
|
-
|
14
|
+
@column_name = options[:column_name]
|
16
15
|
define_query_methods
|
17
|
-
|
18
|
-
attributes.each do |attribute|
|
19
|
-
define_method :"first_by_#{attribute}" do |value|
|
20
|
-
where(::Sequel.pg_jsonb_op(column_name)[Mobility.locale.to_s].contains({ attribute => value })).
|
21
|
-
select_all(model.table_name).first
|
22
|
-
end
|
23
|
-
end
|
24
16
|
end
|
25
17
|
|
26
18
|
private
|
@@ -8,23 +8,10 @@ module Mobility
|
|
8
8
|
class Sequel::Hstore::QueryMethods < Sequel::QueryMethods
|
9
9
|
include Sequel::PgQueryMethods
|
10
10
|
|
11
|
-
def initialize(attributes, _)
|
12
|
-
super
|
13
|
-
|
14
|
-
define_query_methods
|
15
|
-
|
16
|
-
attributes.each do |attribute|
|
17
|
-
define_method :"first_by_#{attribute}" do |value|
|
18
|
-
where(::Sequel.hstore(attribute.to_sym).contains(::Sequel.hstore({ Mobility.locale.to_s => value }))).
|
19
|
-
select_all(model.table_name).first
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
11
|
private
|
25
12
|
|
26
13
|
def matches(key, value, locale)
|
27
|
-
build_op(key)
|
14
|
+
build_op(key)[locale] =~ value.to_s
|
28
15
|
end
|
29
16
|
|
30
17
|
def has_locale(key, locale)
|
@@ -8,19 +8,6 @@ module Mobility
|
|
8
8
|
class Sequel::Jsonb::QueryMethods < Sequel::QueryMethods
|
9
9
|
include Sequel::PgQueryMethods
|
10
10
|
|
11
|
-
def initialize(attributes, _)
|
12
|
-
super
|
13
|
-
|
14
|
-
define_query_methods
|
15
|
-
|
16
|
-
attributes.each do |attribute|
|
17
|
-
define_method :"first_by_#{attribute}" do |value|
|
18
|
-
where(::Sequel.pg_jsonb_op(attribute).contains({ Mobility.locale => value })).
|
19
|
-
select_all(model.table_name).first
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
11
|
private
|
25
12
|
|
26
13
|
def matches(key, value, locale)
|
@@ -8,12 +8,6 @@ module Mobility
|
|
8
8
|
|
9
9
|
define_join_method(association_name, class_name)
|
10
10
|
define_query_methods(association_name)
|
11
|
-
|
12
|
-
attributes.each do |attribute|
|
13
|
-
define_method :"first_by_#{attribute}" do |value|
|
14
|
-
where(attribute => value).select_all(model.table_name).first
|
15
|
-
end
|
16
|
-
end
|
17
11
|
end
|
18
12
|
|
19
13
|
private
|
@@ -13,6 +13,12 @@ models. For details see backend-specific subclasses.
|
|
13
13
|
# @param [Array<String>] attributes Translated attributes
|
14
14
|
def initialize(attributes, _)
|
15
15
|
@attributes = attributes.map!(&:to_sym)
|
16
|
+
|
17
|
+
attributes.each do |attribute|
|
18
|
+
define_method :"first_by_#{attribute}" do |value|
|
19
|
+
where(attribute.to_sym => value).select_all(model.table_name).first
|
20
|
+
end
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
def extract_attributes(cond)
|
@@ -9,12 +9,6 @@ module Mobility
|
|
9
9
|
|
10
10
|
define_join_method(association_name, translation_class, **options)
|
11
11
|
define_query_methods(association_name, translation_class, **options)
|
12
|
-
|
13
|
-
attributes.each do |attribute|
|
14
|
-
define_method :"first_by_#{attribute}" do |value|
|
15
|
-
where(attribute => value).select_all(model.table_name).first
|
16
|
-
end
|
17
|
-
end
|
18
12
|
end
|
19
13
|
|
20
14
|
def define_join_method(association_name, translation_class, table_name: nil, foreign_key: nil, **)
|
data/lib/mobility/version.rb
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|