r18n-core 3.0.3 → 3.0.4

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: 872f0c756206953b74029b1d28dc7b08451891e46d9658471c4a8e97edcde8ef
4
- data.tar.gz: 06cce85cf3acb6e0fdf4d9491cf2ec3371634621a23d770ad16f57c8828ae64b
3
+ metadata.gz: 1a98108d0f919b57a6c864599dcd773ce3eacce7286114c4fb18b168998a59f9
4
+ data.tar.gz: 42f2644371ba8017b1020c05a45013973788465f437a01a12c7b211d1a83b78b
5
5
  SHA512:
6
- metadata.gz: d4343d08637cb686d13e9578fa9a5e64e71c7ac2917b01251fef313768fd563ded2a6b326492eeac0bc44694b2e9fed529fc9712c886cc11c4ea42dc55834a72
7
- data.tar.gz: 99ba4318d206002baae5c7c79d7af2350f8b3bfa8603760609580529b0191ece36f2726d573bc09550bd97b5f53d6fff8894bdb570d17f8139984894097f57f0
6
+ metadata.gz: 051f28f8b5c1dcee329a7e6c3ba8881300cd82ca228b42e0214610570ec4960f3d7800198c056a4edb377c22803bd946c624436c27082be5d171885da1b84bda
7
+ data.tar.gz: c63dc19fce9236dad30181cf411d1922fe66c83a8e8d4023c4fc529dd7987a1153af73b2417918a7f06c26aa6dc41f7cf5efe0a513f05c26e3b1cfed166e6e51
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.4 (𐤀)
4
+ * Fix `Translated` compatibility with `Hash` (by Alexander Popov).
5
+
3
6
  ## 3.0.3 (〥)
4
7
  * Fix missed filters in `Untranslted` initialization (by Alexander Popov).
5
8
 
@@ -165,5 +165,11 @@ module R18n
165
165
  end
166
166
  end
167
167
  alias method_missing []
168
+
169
+ # Return translation located at +names+.
170
+ # @see Hash#dig
171
+ def dig(*keys)
172
+ keys.reduce(self) { |result, key| result[key] }
173
+ end
168
174
  end
169
175
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version of R18n Core
4
4
  module R18n
5
- VERSION = '3.0.3'.freeze unless defined? R18n::VERSION
5
+ VERSION = '3.0.4'.freeze unless defined? R18n::VERSION
6
6
  end
@@ -145,4 +145,20 @@ describe R18n::Translation do
145
145
  translation = R18n::Translation.new(en, '')
146
146
  expect(translation.inspect).to eq('Translation root for en {}')
147
147
  end
148
+
149
+ describe '#dig' do
150
+ subject { R18n::I18n.new('en', DIR).in.dig(*keys) }
151
+
152
+ context 'with existing keys' do
153
+ let(:keys) { %w[another level] }
154
+
155
+ it { is_expected.to be_translated }
156
+ end
157
+
158
+ context 'with non-existing keys' do
159
+ let(:keys) { %w[non-existing level] }
160
+
161
+ it { is_expected.not_to be_translated }
162
+ end
163
+ end
148
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r18n-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Sitnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  R18n is a i18n tool to translate your Ruby application.