error_merger 1.0.1 → 1.2.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: 6dbc3b90b25bd6dc93fdc352da3dee477e34caefcef094af0f8e7fcaf8cca6b9
4
+ data.tar.gz: 90155d54eaad0bee370401666cc6aff5c4ac185e908cbe0a4d31a3219ee16d01
5
5
  SHA512:
6
- metadata.gz: 8e773ba97e0b1f58f8583b1a27a21173b49e392c6c201526df2886ccf10b94fefdbefedad72634f5f8d591d6ab67ef1b949dd2e2e336f9719643cbaf93072997
7
- data.tar.gz: d16c73f04d5753ce608c5114b0eb978df96b279ccecabc1c415269ebc53707a81dba3704a9405543837f80c142a486e2751b2c49bd525cac26ec9aefb864574c
6
+ metadata.gz: 56408c18a41997bf40869aeb37f47cc8bf4114ca63b30f6f63129eaf8aa7bf2fd174ab7f8ddda833d2c2e42e8a78960fdbd5b038b3a0198b04468030014e491e
7
+ data.tar.gz: d04027b123849ce8f58950161d44d40d45be411f919448c429c75070c2a92a8450892079f9f65aff20974f678ed0b566632675a6af14b33262bda6cde806e561
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  Gemfile.*.lock
8
7
  InstalledFiles
9
8
  _yardoc
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ error_merger (1.2.0)
5
+ activemodel (>= 6.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (7.0.8)
11
+ activesupport (= 7.0.8)
12
+ activesupport (7.0.8)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ concurrent-ruby (1.2.2)
18
+ i18n (1.14.1)
19
+ concurrent-ruby (~> 1.0)
20
+ minitest (5.20.0)
21
+ rake (13.0.6)
22
+ tzinfo (2.0.6)
23
+ concurrent-ruby (~> 1.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler
30
+ error_merger!
31
+ rake
32
+
33
+ BUNDLED WITH
34
+ 2.2.22
data/error_merger.gemspec CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.required_ruby_version = '>= 2.3'
21
+ spec.required_ruby_version = '>= 2.7'
22
22
 
23
- spec.add_dependency 'activemodel', '>= 5.2', '< 6.2'
23
+ spec.add_dependency 'activemodel', '>= 6.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.2.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.2.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: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,34 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '6.2'
19
+ version: '6.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '5.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '6.2'
26
+ version: '6.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: bundler
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '1.3'
33
+ version: '0'
40
34
  type: :development
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - "~>"
38
+ - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: '1.3'
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rake
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -68,12 +62,11 @@ extra_rdoc_files: []
68
62
  files:
69
63
  - ".gitignore"
70
64
  - Gemfile
65
+ - Gemfile.lock
71
66
  - LICENSE.txt
72
67
  - README.md
73
68
  - Rakefile
74
69
  - error_merger.gemspec
75
- - gemfiles/Gemfile.rails52
76
- - gemfiles/Gemfile.rails60
77
70
  - gemfiles/Gemfile.rails61
78
71
  - lib/error_merger.rb
79
72
  - lib/error_merger/error_merger.rb
@@ -94,14 +87,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
87
  requirements:
95
88
  - - ">="
96
89
  - !ruby/object:Gem::Version
97
- version: '2.3'
90
+ version: '2.7'
98
91
  required_rubygems_version: !ruby/object:Gem::Requirement
99
92
  requirements:
100
93
  - - ">="
101
94
  - !ruby/object:Gem::Version
102
95
  version: '0'
103
96
  requirements: []
104
- rubygems_version: 3.0.9
97
+ rubygems_version: 3.4.10
105
98
  signing_key:
106
99
  specification_version: 4
107
100
  summary: Enhances the Error class on ActiveModel-compliant models
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'activemodel', '~> 5.2.0'
4
-
5
- # Specify your gem's dependencies in error_merger.gemspec
6
- gemspec path: '..'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'activemodel', '~> 6.0.0'
4
-
5
- # Specify your gem's dependencies in error_merger.gemspec
6
- gemspec path: '..'