translateable_attributes 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 270dd98dafc047e70a55f988a2a5cab26fce1365
4
- data.tar.gz: 494dc691dc735dd0e388c1cb67f5a5f1e1f4e16b
2
+ SHA256:
3
+ metadata.gz: '08b5e2a012385947321e5c7be4cb4f87337d9fcd3e0533e23bc2d9fef4e28d4d'
4
+ data.tar.gz: 9fc725b5dc4b6182575f3542c07a29a04dae1ff0602cbc1907b8991820e9dae1
5
5
  SHA512:
6
- metadata.gz: a04cb78cc73fcabb40dd09432972984f94c2536350cdf9a6811581ed81c80338f34b839ebd3d8013b90209c0859257611f09bcd5ea1d465e3c41a64001183993
7
- data.tar.gz: 4603671a4ce46d56020f8df3d7be2393832aa427267c88f81adedb68e0d1f0287309d700bfcd588570079f716140d93f84b658de5a096c11e10a62566aaa4b6f
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).each_with_object([]) do |(value, translation), collection|
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
@@ -1,3 +1,3 @@
1
1
  module TranslateableAttributes
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'translateable_attributes/version'
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.0
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: 2016-12-08 00:00:00.000000000 Z
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
- rubyforge_project:
140
- rubygems_version: 2.5.1
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: []