mobility 1.2.3 → 1.2.4
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/mobility/plugins/fallbacks.rb +16 -17
- data/lib/mobility/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0dd974f8a077b31fc0ab41df158e4cac50c6aee4e7fd66348db1ed2ef5f78f9
|
4
|
+
data.tar.gz: ea72521a4bb8daedf08d3012353c591ec47f76e3fe6ec3c10b87e331a5404db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b9df45774c9b3d4ae343b2f083b2a85ddfd7585283998b0dc624aa62eee5c6e5fade0737ae78b3dd728dd273a03dcf10afecabcca6eb8f90400619de0a7fa4
|
7
|
+
data.tar.gz: 1f199821139bf35b4e176f52dac0249f482ffb5edc9d7957d437e9262a908812fab01ba5dea52e18a9b1f37f92744b345c34ca0c84d97da0641f9fab19577704
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -117,10 +117,21 @@ the current locale was +nil+.
|
|
117
117
|
# Applies fallbacks plugin to attributes. Completely disables fallbacks
|
118
118
|
# on model if option is +false+.
|
119
119
|
included_hook do |_, backend_class|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
unless options[:fallbacks] == false
|
121
|
+
backend_class.include(BackendInstanceMethods)
|
122
|
+
|
123
|
+
fallbacks =
|
124
|
+
if options[:fallbacks].is_a?(Hash)
|
125
|
+
generate_fallbacks(options[:fallbacks])
|
126
|
+
elsif options[:fallbacks] == true
|
127
|
+
generate_fallbacks({})
|
128
|
+
else
|
129
|
+
::Hash.new { [] }
|
130
|
+
end
|
131
|
+
|
132
|
+
backend_class.singleton_class.attr_reader :fallbacks
|
133
|
+
backend_class.instance_variable_set(:@fallbacks, fallbacks)
|
134
|
+
end
|
124
135
|
end
|
125
136
|
|
126
137
|
private
|
@@ -140,7 +151,7 @@ the current locale was +nil+.
|
|
140
151
|
def read(locale, fallback: true, **kwargs)
|
141
152
|
return super(locale, **kwargs) if !fallback || kwargs[:locale]
|
142
153
|
|
143
|
-
locales = fallback == true ? fallbacks[locale] : [locale, *fallback]
|
154
|
+
locales = fallback == true ? self.class.fallbacks[locale] : [locale, *fallback]
|
144
155
|
locales.each do |fallback_locale|
|
145
156
|
value = super(fallback_locale, **kwargs)
|
146
157
|
return value if Util.present?(value)
|
@@ -148,18 +159,6 @@ the current locale was +nil+.
|
|
148
159
|
|
149
160
|
super(locale, **kwargs)
|
150
161
|
end
|
151
|
-
|
152
|
-
private
|
153
|
-
|
154
|
-
def fallbacks
|
155
|
-
if options[:fallbacks].is_a?(Hash)
|
156
|
-
generate_fallbacks(options[:fallbacks])
|
157
|
-
elsif options[:fallbacks] == true
|
158
|
-
generate_fallbacks({})
|
159
|
-
else
|
160
|
-
::Hash.new { [] }
|
161
|
-
end
|
162
|
-
end
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
data/lib/mobility/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
eBMcZq0d1tbtv1M1UXND9mOfhLZ31YvoSTPkrJiRpljUNgD0+ugelnr1/5X/9k8y
|
35
35
|
J9QOd3C5jpSShf/HMvpJnFuSYFm19cH9GrHjvw==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2021-
|
37
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: request_store
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
�}�=�''g�s�0�J)�������^�(����h*G��=^ �~V2����;\v_6K�݆f�ߵP�P�E�h�G�۶�$���Χ�5k�uS
|
2
|
+
2�6�C;�}SMw�k�bL�
|
3
|
+
���Yԝ������{u�T��0L�wz��:qJ-8���<g�G�>#
|
4
|
+
jg_ko���^^ɓO�͜B��ݯ��/��~xGV���Vc��Ww��ѥVu"�۟2�#�C��hڴW�J�^.U���+蕕&8�)~��[���6������S�&��6mX�5F�~B4.�6�t�&�4������#����Ң��l�$����4-�Uc7d��A*����J��g��;tD�$
|