dry-validation 0.12.1 → 0.12.2

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: 01f5455cb0e7ee2ba55a6a055a89964e7e834d9ea041822ba5967b3c1bbc3d5c
4
- data.tar.gz: b5a127f7962dafee92453f4ce45ba6e4d64d58d599c7328908d33698417cfe38
3
+ metadata.gz: e7945890b1fef5020ac062f401377a743cc368ea6933f43af2002ac34d55931b
4
+ data.tar.gz: 6f59602ee9926bd70c30999e7c36b45343bbb00fbc95e192e207ddadc8ede7df
5
5
  SHA512:
6
- metadata.gz: 4acc0c46fd68b9590fa10b1509fd651f0bfa78e40d573ee47b63eae4107cacc8edbcc5ebe3b92b8b3836c7cb7b856fe6169e2cbda412801547a6e4df3b5732ee
7
- data.tar.gz: 13b6f004c27747acf1a5899457fcddd54ade5b31c94d7b41b6901561e326fa86451408c102d96f05c303253a5c42d5bb495e372094fbdc3fb167b7cb5585afe0
6
+ metadata.gz: 172885260e7c0d248be46d7476ae6682f8a789eb76514829d1f982814c14a9d7783a5d223631d7ab22c40400f7ebecf6c7c9b98ab276048c3f654134b16ede7b
7
+ data.tar.gz: fcd3fc4e2f3cafca79f5a30fadd5ecc754890b257659433ec8d8df44b444c3a7c98bf08d35dc4f42c031d2b271ab24ec2c1ae12030523c3f588c44365ad7ed39
@@ -1,9 +1,19 @@
1
+ # v0.12.2 2018-08-29
2
+
3
+ ### Fixed
4
+
5
+ * Use correct key names for rule messages when using i18n (jozzi05)
6
+
7
+ [Compare v0.12.1...v0.12.2](https://github.com/dry-rb/dry-validation/compare/v0.12.1...v0.12.2)
8
+
1
9
  # v0.12.1 2018-07-06
2
10
 
3
11
  ### Fixed
4
12
 
5
13
  * [internal] fixed deprecation warnings (flash-gordon)
6
14
 
15
+ [Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-validation/compare/v0.12.0...v0.12.1)
16
+
7
17
  # v0.12.0 2018-05-31
8
18
 
9
19
  ### Changed
@@ -17,6 +17,11 @@ module Dry
17
17
  t.(key, options) if key
18
18
  end
19
19
 
20
+ def rule(name, options = {})
21
+ path = "rules.#{name}"
22
+ get(path, options) if key?(path, options)
23
+ end
24
+
20
25
  def key?(key, options)
21
26
  ::I18n.exists?(key, options.fetch(:locale, default_locale)) ||
22
27
  ::I18n.exists?(key, I18n.default_locale)
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Validation
3
- VERSION = '0.12.1'.freeze
3
+ VERSION = '0.12.2'.freeze
4
4
  end
5
5
  end
@@ -16,3 +16,7 @@ pl:
16
16
  rules:
17
17
  email:
18
18
  filled?: "Hej user! Dawaj ten email no!"
19
+
20
+ rules:
21
+ email:
22
+ 'Adres email'
@@ -47,6 +47,14 @@ RSpec.describe Messages::I18n do
47
47
  end
48
48
  end
49
49
 
50
+ context 'rule name translations' do
51
+ it 'translates rule name' do
52
+ msg = messages.rule('email')
53
+
54
+ expect(msg).to eql('Adres email')
55
+ end
56
+ end
57
+
50
58
  context 'with a different locale' do
51
59
  it 'returns a message for a predicate' do
52
60
  message = messages[:filled?, rule: :name, locale: :en]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-05 00:00:00.000000000 Z
12
+ date: 2018-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -371,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
371
371
  version: '0'
372
372
  requirements: []
373
373
  rubyforge_project:
374
- rubygems_version: 2.7.6
374
+ rubygems_version: 2.7.7
375
375
  signing_key:
376
376
  specification_version: 4
377
377
  summary: A simple validation library