whiny_validation 1.0 → 1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1eca817b17163a98a725ccea97ea7b0dbbb68a83
4
- data.tar.gz: ccc913f2734a282feea927ae07ac094ce0a5bca7
2
+ SHA256:
3
+ metadata.gz: 29b7d8158ea77148918fbe3190467de13a42fc6f8f6f982beac6918a3ff38521
4
+ data.tar.gz: c5547fa0749947d4a4f9d66ed1f3d5fffd444cf3fd58daca8d7d1e3dae451946
5
5
  SHA512:
6
- metadata.gz: 26c0aa6a13e65f8ce6b49cfc520aac4e279fb4024012b79612b24c83dc6a8929b5ee85a510b24329d744542b6e7af7560455e928024a3802fb77b51cab70b054
7
- data.tar.gz: ff532993524a4cc2804a328b4af0bbd44b53dde7d034d2c75ff03695b5507cea56bf372de200aab2f0c63c4666826f20ba3f2e34217a2dc4b4aeda7dd398ba53
6
+ metadata.gz: 3d78905e6eeaf4b159dd248bf4a1497193d6dbd40961598b27f5b7ad97ef798146b37bf5202475566d8cfee43c1c3ef9f9b6130e308217f75fc46b2bee44d58e
7
+ data.tar.gz: 6dbac61f0b98fadcc58f00afb5290167a05087251aaf4d8871b88cf94ca18d396b5c094e332cd946ad3b4c1a20e442379e351883eb0e5ca27ad88bd4fb9833d5
@@ -1,3 +1,3 @@
1
1
  module WhinyValidation
2
- VERSION = "1.0"
2
+ VERSION = "1.1"
3
3
  end
@@ -18,9 +18,17 @@ module WhinyValidation
18
18
  end
19
19
 
20
20
  class LogSubscriber < ActiveSupport::LogSubscriber
21
+ def color_mode_options
22
+ if ActiveSupport.gem_version < Gem::Version.new("7.1.0")
23
+ true
24
+ else
25
+ { bold: true }
26
+ end
27
+ end
28
+
21
29
  def validation_failed(event)
22
30
  send(WhinyValidation.configuration.log_level) do
23
- name = color("Validation failed", YELLOW, true)
31
+ name = color("Validation failed", YELLOW, color_mode_options)
24
32
  object = event.payload[:object]
25
33
  error_messages = color(event.payload[:error_messages].map{|message|" => #{message}"}.join("\n"), YELLOW)
26
34
 
@@ -32,8 +40,10 @@ module WhinyValidation
32
40
  WhinyValidation::LogSubscriber.attach_to :whiny_validation
33
41
  end
34
42
 
35
- module ActiveRecord
36
- class Base
37
- include WhinyValidation
43
+ if defined?(ActiveRecord)
44
+ # ActiveRecord is dependent on ActiveSupport so we are good
45
+ # with calling ActiveSupport
46
+ ActiveSupport.on_load(:active_record) do
47
+ ActiveRecord::Base.send(:include, WhinyValidation)
38
48
  end
39
- end if defined? ActiveRecord
49
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whiny_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Morearty
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2023-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -117,7 +117,7 @@ files:
117
117
  homepage: https://github.com/BMorearty/whiny_validation
118
118
  licenses: []
119
119
  metadata: {}
120
- post_install_message:
120
+ post_install_message:
121
121
  rdoc_options: []
122
122
  require_paths:
123
123
  - lib
@@ -132,9 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.2.5
137
- signing_key:
135
+ rubygems_version: 3.3.7
136
+ signing_key:
138
137
  specification_version: 4
139
138
  summary: Write ActiveRecord/ActiveModel validation error messages to the log
140
139
  test_files: