i18n 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1204b01f3c5f6a008558634c20f7101001d0c3ddf6a377f2d3abae1d263236f
4
- data.tar.gz: bbd19a13dbcc3eafe8229f20c230b6545f713ecd34cf95ccd077cf38a8d2f763
3
+ metadata.gz: 8261641c6a20a87755f261c21a4148f5b414577c2fbc127b31ffaf59e93bb88e
4
+ data.tar.gz: 8710ff18593cdab6cdd2388f3726d3da41d5a1129eade70b3cac8e8d100c804b
5
5
  SHA512:
6
- metadata.gz: b225fd4067de248b3a1ef958aedcb78f4ea0a74ba7f06335ca33616a4703d013387753dd1ac9eaa15e4dab94fda57e7d610c627ea7777c79f2bf2f886130f3ac
7
- data.tar.gz: cde28715096eba32109e7709db5fec75d8cf69ed2a6d2f8ffa32a328698043c8a96676f678ca230ccb11b338cbc5798993649ebfbfd437f5a1ab49583b741ea8
6
+ metadata.gz: 3a74081f5e0ad3d800857b64541ec97e0d48602bfc81b5d1e54a72ede4e8244599f9d1f3b07a0ed33eb6f2e5730c80f468e1097815fadde9f9c0c1edd63f1b10
7
+ data.tar.gz: 3ff46b06293eaa68353b15a64645323da870e6afa0f8a2b5f3559983966166a950e74cf2ade96cf3a3d22cb7940d01b448feecb71ad052bf43433ebbe1da2c3c
@@ -1,20 +1,19 @@
1
1
  module I18n
2
2
  module HashRefinements
3
3
  refine Hash do
4
- def slice(*keep_keys)
5
- h = {}
6
- keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
7
- h
4
+ using I18n::HashRefinements
5
+ def except(*keys)
6
+ dup.except!(*keys)
8
7
  end
9
8
 
10
- def except(*less_keys)
11
- slice(*keys - less_keys)
9
+ def except!(*keys)
10
+ keys.each { |key| delete(key) }
11
+ self
12
12
  end
13
13
 
14
14
  def deep_symbolize_keys
15
15
  each_with_object({}) do |(key, value), result|
16
- value = value.deep_symbolize_keys if value.is_a?(Hash)
17
- result[symbolize_key(key)] = value
16
+ result[symbolize_key(key)] = deep_symbolize_keys_in_object(value)
18
17
  result
19
18
  end
20
19
  end
@@ -27,11 +26,22 @@ module I18n
27
26
  merge!(data, &merger)
28
27
  end
29
28
 
30
- private
31
-
32
29
  def symbolize_key(key)
33
30
  key.respond_to?(:to_sym) ? key.to_sym : key
34
31
  end
32
+
33
+ private
34
+
35
+ def deep_symbolize_keys_in_object(value)
36
+ case value
37
+ when Hash
38
+ value.deep_symbolize_keys
39
+ when Array
40
+ value.map { |e| deep_symbolize_keys_in_object(e) }
41
+ else
42
+ value
43
+ end
44
+ end
35
45
  end
36
46
  end
37
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18n
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-12-20 00:00:00.000000000 Z
16
+ date: 2019-01-01 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: concurrent-ruby
@@ -56,7 +56,6 @@ files:
56
56
  - lib/i18n/backend/transliterator.rb
57
57
  - lib/i18n/config.rb
58
58
  - lib/i18n/core_ext/hash.rb
59
- - lib/i18n/core_ext/string/interpolate.rb
60
59
  - lib/i18n/exceptions.rb
61
60
  - lib/i18n/gettext.rb
62
61
  - lib/i18n/gettext/helpers.rb
@@ -1,9 +0,0 @@
1
- # This file used to backport the Ruby 1.9 String interpolation syntax to Ruby 1.8.
2
- #
3
- # Since I18n has dropped support to Ruby 1.8, this file is not required anymore,
4
- # however, Rails 3.2 still requires it directly:
5
- #
6
- # https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/core_ext/string/interpolation.rb#L2
7
- #
8
- # So we can't just drop the file entirely, which would then break Rails users
9
- # under Ruby 1.9. This file can be removed once Rails 3.2 support is dropped.