translateable_attributes 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +18 -0
- data/HISTORY.md +6 -0
- data/lib/translateable_attributes/methods.rb +5 -2
- data/lib/translateable_attributes/version.rb +1 -1
- data/translateable_attributes.gemspec +0 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08b5e2a012385947321e5c7be4cb4f87337d9fcd3e0533e23bc2d9fef4e28d4d'
|
4
|
+
data.tar.gz: 9fc725b5dc4b6182575f3542c07a29a04dae1ff0602cbc1907b8991820e9dae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0c0d8d2cf87dcbbdd1da233311c975a966da5618aac09877d9a1317bf0ca3ce43a25a79ac04f6e06179483227da1c3f185055ea2637f4e7e626418e3417c49f
|
7
|
+
data.tar.gz: 30844cf23593caade015461f43f3b84296477a8b406a85924435185ca9a44d56962f31f6ea098e7cc27a21548e2c67cdb2cee876586c82714306f2dd5fa7c063
|
data/.rubocop.yml
CHANGED
@@ -6,6 +6,9 @@ AllCops:
|
|
6
6
|
Metrics/LineLength:
|
7
7
|
Max: 145
|
8
8
|
|
9
|
+
Metrics/BlockLength:
|
10
|
+
Max: 45
|
11
|
+
|
9
12
|
Style/Documentation:
|
10
13
|
Enabled: false
|
11
14
|
|
@@ -17,3 +20,18 @@ Style/ClassAndModuleChildren:
|
|
17
20
|
|
18
21
|
Style/MethodLength:
|
19
22
|
Enabled: false
|
23
|
+
|
24
|
+
Style/FrozenStringLiteralComment:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Gemspec/RequiredRubyVersion:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/ExpandPathArguments:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/SymbolArray:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/FormatStringToken:
|
37
|
+
Enabled: false
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.3.2
|
2
|
+
Default attributes_for_select to an empty array if no translation found - https://github.com/tmikoss/translateable_attributes/pull/4
|
3
|
+
|
4
|
+
### 0.3.1
|
5
|
+
Update for compatibility with I18n 1.8.9
|
6
|
+
|
1
7
|
### 0.3.0
|
2
8
|
Allow options to be passed to I18n translation method calls
|
3
9
|
|
@@ -11,13 +11,15 @@ module TranslateableAttributes
|
|
11
11
|
end
|
12
12
|
|
13
13
|
define_singleton_method "#{plural_attribute}_for_select" do
|
14
|
-
I18n.t(namespace
|
14
|
+
options = I18n.t(namespace, default: nil) || []
|
15
|
+
|
16
|
+
options.each_with_object([]) do |(value, translation), collection|
|
15
17
|
collection << [translation, value]
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
21
|
define_singleton_method "translated_#{attribute}" do |value, translation_options = {}|
|
20
|
-
I18n.t([namespace, value].join('.'), translation_options)
|
22
|
+
I18n.t([namespace, value].join('.'), **translation_options)
|
21
23
|
end
|
22
24
|
|
23
25
|
define_singleton_method "possible_#{plural_attribute}" do
|
@@ -25,5 +27,6 @@ module TranslateableAttributes
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
30
|
+
# rubocop:enable Metrics/AbcSize
|
28
31
|
end
|
29
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translateable_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toms Mikoss
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -121,7 +121,7 @@ homepage: https://github.com/tmikoss/translateable_attributes
|
|
121
121
|
licenses:
|
122
122
|
- MIT
|
123
123
|
metadata: {}
|
124
|
-
post_install_message:
|
124
|
+
post_install_message:
|
125
125
|
rdoc_options: []
|
126
126
|
require_paths:
|
127
127
|
- lib
|
@@ -136,9 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
|
140
|
-
|
141
|
-
signing_key:
|
139
|
+
rubygems_version: 3.3.17
|
140
|
+
signing_key:
|
142
141
|
specification_version: 4
|
143
142
|
summary: Helper methods to display translated values of object attributes.
|
144
143
|
test_files: []
|