error_merger 1.0.1 → 1.1.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: 04c86c83cf6f379820aa9192b42c5a957851a5ca7e115e98be6c958c53d02a37
4
- data.tar.gz: 0c332e185ae4dfbf4a987785faa15c8c413abdbff132076d622b4f9009b0b5cb
3
+ metadata.gz: 205eda2c943d4f26c76a28bf4f477616f35d5978b75692f51c0955cba7cd2ab0
4
+ data.tar.gz: 39420e066d2b4185673fc7f2e6af385fd88461ae9f53a25acb620fb16ec4a1fb
5
5
  SHA512:
6
- metadata.gz: 8e773ba97e0b1f58f8583b1a27a21173b49e392c6c201526df2886ccf10b94fefdbefedad72634f5f8d591d6ab67ef1b949dd2e2e336f9719643cbaf93072997
7
- data.tar.gz: d16c73f04d5753ce608c5114b0eb978df96b279ccecabc1c415269ebc53707a81dba3704a9405543837f80c142a486e2751b2c49bd525cac26ec9aefb864574c
6
+ metadata.gz: ffdebf8c8531d2935490a955ccefd5fea34697bb6f3209bf5c07a18e44aa84a000c4d018157257d588c15adc1a61340c12eec5e80c2c3d849c7009618dc30505
7
+ data.tar.gz: b71f83a4f941216ee71b1f47059b6445494c726c005486f3a0553de897ed7848e8bd50af6f34df70a577c21f57078bab73acd9dcbc7873f7b9b4a5ac95e9c737
data/error_merger.gemspec CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 2.3'
22
22
 
23
- spec.add_dependency 'activemodel', '>= 5.2', '< 6.2'
23
+ spec.add_dependency 'activemodel', '>= 5.2', '< 7.1'
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'bundler'
26
26
  spec.add_development_dependency 'rake'
27
27
  end
@@ -33,7 +33,7 @@ module ErrorMerger
33
33
  if defined?(ActiveModel::Error)
34
34
  map do |error|
35
35
  m = error.full_message
36
- m.end_with?('.') ? m : "#{m}."
36
+ m =~ %r{[.?!。]$} ? m : "#{m}."
37
37
  end
38
38
  else
39
39
  map{ |attr, m| full_sentence(attr, m) }
@@ -42,7 +42,7 @@ module ErrorMerger
42
42
 
43
43
  def full_sentence(attribute, message)
44
44
  m = full_message(attribute, message)
45
- m.end_with?('.') ? m : "#{m}."
45
+ m =~ %r{[.?!。]$} ? m : "#{m}."
46
46
  end
47
47
 
48
48
  def join_sentences
@@ -1,3 +1,3 @@
1
1
  module ErrorMerger
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -84,6 +84,9 @@ class ErrorMergerTest < ActiveSupport::TestCase
84
84
  test "sentences" do
85
85
  assert_equal "Name is invalid.", @author.errors.full_sentence(:name, "is invalid")
86
86
  assert_equal "Name is invalid.", @author.errors.full_sentence(:name, "is invalid.")
87
+ assert_equal "Name is invalid!", @author.errors.full_sentence(:name, "is invalid!")
88
+ assert_equal "Name is invalid?", @author.errors.full_sentence(:name, "is invalid?")
89
+ assert_equal "Name is invalid。", @author.errors.full_sentence(:name, "is invalid。")
87
90
 
88
91
  @author.errors.add :name, :invalid
89
92
  assert_equal ["Name can't be blank.", "Name is invalid."], @author.errors.full_sentences
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: error_merger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.2'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,21 @@ dependencies:
29
29
  version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.2'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '1.3'
39
+ version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '1.3'
46
+ version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.0.9
104
+ rubygems_version: 3.2.22
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Enhances the Error class on ActiveModel-compliant models