mobility 0.7.3 → 0.7.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.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/mobility.rb +9 -2
- 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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9a9d5c551c18a0df94133a0adc5182d872afcab3e690a4580f480fab66cd09
|
4
|
+
data.tar.gz: b4a9efc3055adc3ee91d5fe47ba42a1b2f59bb00d820537d4ae2e3588e556753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c2658659e778be404e1c5f66b2d873a7d7a5a7f8a9f8b15773105949f6f29e7e8c9654e0e77a919b4bcc2472c31bdc29f82ec5cf0275db81e0a3575caf6f29
|
7
|
+
data.tar.gz: e20925dc8d6d4152f58b038101de146735a34919bfe7a91b3605ec08b7b1a5a76c177e227428d7a80219d7c414bf71804d6a01f7fead43857b3870214ce6b7b9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## 0.7
|
4
4
|
|
5
|
+
### 0.7.4 (June 8, 2018)
|
6
|
+
* Handle locales with multiple dashes in locale accessors, or raise
|
7
|
+
ArgumentError for invalid format
|
8
|
+
([#253](https://github.com/shioyama/mobility/pull/253))
|
9
|
+
|
5
10
|
### 0.7.3 (June 7, 2018)
|
6
11
|
* Fix uniqueness on Mobility model with no translated attributes ([#252](Fix
|
7
12
|
uniqueness on Mobility model with no translated attributes))
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/mobility.rb
CHANGED
@@ -37,6 +37,8 @@ module Mobility
|
|
37
37
|
|
38
38
|
# General error for version compatibility conflicts
|
39
39
|
class VersionNotSupportedError < ArgumentError; end
|
40
|
+
CALL_COMPILABLE_REGEXP = /\A[a-zA-Z_]\w*[!?]?\z/
|
41
|
+
private_constant :CALL_COMPILABLE_REGEXP
|
40
42
|
|
41
43
|
begin
|
42
44
|
require "rails"
|
@@ -198,7 +200,7 @@ module Mobility
|
|
198
200
|
# Mobility.normalize_locale("pt-BR")
|
199
201
|
# #=> "pt_br"
|
200
202
|
def normalize_locale(locale = Mobility.locale)
|
201
|
-
"#{locale.to_s.downcase.
|
203
|
+
"#{locale.to_s.downcase.tr("-", "_")}"
|
202
204
|
end
|
203
205
|
alias_method :normalized_locale, :normalize_locale
|
204
206
|
|
@@ -206,13 +208,18 @@ module Mobility
|
|
206
208
|
# @param [String,Symbol] attribute
|
207
209
|
# @param [String,Symbol] locale
|
208
210
|
# @return [String] Normalized locale accessor name
|
211
|
+
# @raise [ArgumentError] if generated accessor has an invalid format
|
209
212
|
# @example
|
210
213
|
# Mobility.normalize_locale_accessor(:foo, :ja)
|
211
214
|
# #=> "foo_ja"
|
212
215
|
# Mobility.normalize_locale_accessor(:bar, "pt-BR")
|
213
216
|
# #=> "bar_pt_br"
|
214
217
|
def normalize_locale_accessor(attribute, locale = Mobility.locale)
|
215
|
-
"#{attribute}_#{normalize_locale(locale)}"
|
218
|
+
"#{attribute}_#{normalize_locale(locale)}".tap do |accessor|
|
219
|
+
unless CALL_COMPILABLE_REGEXP.match(accessor)
|
220
|
+
raise ArgumentError, "#{accessor.inspect} is not a valid accessor"
|
221
|
+
end
|
222
|
+
end
|
216
223
|
end
|
217
224
|
|
218
225
|
# Raises InvalidLocale exception if the locale passed in is present but not available.
|
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.7.
|
4
|
+
version: 0.7.4
|
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-06-
|
33
|
+
date: 2018-06-08 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
|