coaster 1.0.7 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coaster.rb +11 -1
- data/lib/coaster/core_ext/object_translation.rb +7 -12
- data/lib/coaster/core_ext/standard_error.rb +42 -30
- data/lib/coaster/version.rb +1 -1
- data/test/locales/en.yml +4 -0
- data/test/test_helper.rb +4 -0
- data/test/test_object_translation.rb +2 -0
- data/test/test_standard_error.rb +115 -29
- metadata +27 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeeb91379c4231e8622891bfbfee5c93c202e96706bfa7d569b4bcea3e19d696
|
4
|
+
data.tar.gz: 124f01130e4fadf67e9e28c134e409986f8d1186e324f1b93e35fdf040a09652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9c0490709aa11a3c96816294702dbebd982b7304af0633f319612035f4be627f030a928749506d454fd2806c485b6e440c37c0895dae8ec2633a780a66f4dd
|
7
|
+
data.tar.gz: 5a7de756347f74c4ece3dad9b36a987d44715b29cca55ded06d2a1bdfb0b38f4e16c654a4d9c2db3284c4cf76ab629afcbfa3bc33f373eeb21fc52db8008d6e0
|
data/lib/coaster.rb
CHANGED
@@ -5,7 +5,7 @@ require 'active_support/core_ext/string'
|
|
5
5
|
require 'active_support/core_ext/hash/slice'
|
6
6
|
|
7
7
|
module Coaster
|
8
|
-
|
8
|
+
mattr_writer :logger
|
9
9
|
mattr_writer :default_fingerprint
|
10
10
|
|
11
11
|
DEFAULT_FINGERPRINT = [:default, :class].freeze
|
@@ -18,6 +18,16 @@ module Coaster
|
|
18
18
|
def default_fingerprint
|
19
19
|
@@default_fingerprint ||= DEFAULT_FINGERPRINT
|
20
20
|
end
|
21
|
+
|
22
|
+
def logger
|
23
|
+
return @@logger if defined?(@@logger) && @@logger
|
24
|
+
return Rails.logger if defined?(Rails)
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def logger
|
30
|
+
self.class.logger
|
21
31
|
end
|
22
32
|
end
|
23
33
|
|
@@ -4,7 +4,7 @@ class Object
|
|
4
4
|
class << self
|
5
5
|
def _translate(*args)
|
6
6
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
7
|
-
options.merge
|
7
|
+
options = _translate_params.merge(options)
|
8
8
|
options = options.to_hash.symbolize_keys!
|
9
9
|
|
10
10
|
key = args.shift
|
@@ -45,7 +45,10 @@ class Object
|
|
45
45
|
|
46
46
|
if key_class.superclass == Object || key_class == Object
|
47
47
|
return options[:description] if options[:description].present?
|
48
|
-
Coaster.logger
|
48
|
+
if Coaster.logger
|
49
|
+
Coaster.logger.info(options[:original_missing])
|
50
|
+
Coaster.logger.debug(caller.join("\n"))
|
51
|
+
end
|
49
52
|
throw :exception, result if options[:original_throw]
|
50
53
|
missing = options[:original_missing] || result
|
51
54
|
msg = missing.message
|
@@ -61,6 +64,7 @@ class Object
|
|
61
64
|
result = result.dup if result.frozen?
|
62
65
|
result.instance_variable_set(:@translated, true)
|
63
66
|
result.instance_variable_set(:@tkey, options[:tkey])
|
67
|
+
result.instance_variable_set(:@missing, options[:original_missing])
|
64
68
|
result
|
65
69
|
end
|
66
70
|
end
|
@@ -78,16 +82,7 @@ class Object
|
|
78
82
|
def _translate(*args)
|
79
83
|
options = (args.last.is_a?(Hash) ? args.pop : {}).with_indifferent_access
|
80
84
|
key = args.shift || (respond_to?(:tkey) ? tkey : nil)
|
81
|
-
|
82
|
-
if respond_to?(:description) && description.present? && description != 'false' && description != self.class.name
|
83
|
-
if !key.is_a?(String) && key != :force
|
84
|
-
desc = description
|
85
|
-
return desc unless desc.instance_variable_get(:@raw)
|
86
|
-
end
|
87
|
-
options.merge!(description: description)
|
88
|
-
end
|
89
|
-
|
90
|
-
options.merge!(_translate_params)
|
85
|
+
options = _translate_params.merge(options)
|
91
86
|
self.class._translate(key, *args, options)
|
92
87
|
end
|
93
88
|
|
@@ -9,11 +9,7 @@ class StandardError
|
|
9
9
|
def http_status; 500 end
|
10
10
|
def report?; true end
|
11
11
|
def intentional?; false end
|
12
|
-
|
13
|
-
def title
|
14
|
-
t = _translate('.title')
|
15
|
-
t.instance_variable_defined?(:@missing) ? nil : t
|
16
|
-
end
|
12
|
+
def title; _translate('.title') end
|
17
13
|
|
18
14
|
def before_logging(name, &block)
|
19
15
|
@before_logging_blocks ||= {}
|
@@ -21,7 +17,7 @@ class StandardError
|
|
21
17
|
end
|
22
18
|
def before_logging_blocks
|
23
19
|
@before_logging_blocks ||= {}
|
24
|
-
superclass <= StandardError ? superclass.
|
20
|
+
superclass <= StandardError ? superclass.before_logging_blocks.merge(@before_logging_blocks) : @before_logging_blocks
|
25
21
|
end
|
26
22
|
|
27
23
|
def after_logging(name, &block)
|
@@ -61,23 +57,23 @@ class StandardError
|
|
61
57
|
msg = hash.delete(:m)
|
62
58
|
msg = hash.delete(:msg) || msg
|
63
59
|
msg = hash.delete(:message) || msg
|
60
|
+
hash[:description] ||= hash.delete(:desc) if hash[:desc].present?
|
64
61
|
@fingerprint = hash.delete(:fingerprint) || hash.delete(:fingerprints)
|
65
62
|
@tags = hash.delete(:tags) || hash.delete(:tag)
|
66
63
|
@level = hash.delete(:level) || hash.delete(:severity) || @level
|
67
64
|
@tkey = hash.delete(:tkey)
|
68
|
-
msg = cause.message if msg.nil? && cause
|
69
65
|
@attributes.merge!(hash)
|
70
66
|
when String then
|
71
67
|
msg = message
|
72
68
|
when FalseClass, NilClass then
|
73
|
-
msg =
|
69
|
+
msg = nil
|
74
70
|
else
|
75
71
|
msg = message
|
76
72
|
end
|
77
73
|
|
78
74
|
@fingerprint = [] unless @fingerprint.is_a?(Array)
|
79
75
|
@tags = {} unless @tags.is_a?(Hash)
|
80
|
-
msg
|
76
|
+
msg = cause.message if msg.blank? && cause
|
81
77
|
super(msg)
|
82
78
|
end
|
83
79
|
|
@@ -117,24 +113,44 @@ class StandardError
|
|
117
113
|
def object; attributes[:object] || attributes[:obj] end
|
118
114
|
alias_method :obj, :object
|
119
115
|
|
120
|
-
# description is user friendly
|
116
|
+
# description is user friendly message as a attribute, do not use error's message
|
121
117
|
# error message is not user friendly in many cases.
|
122
118
|
def description
|
123
|
-
|
124
|
-
return dsc if dsc
|
125
|
-
msg = safe_message.dup
|
126
|
-
msg.instance_variable_set(:@raw, true)
|
127
|
-
msg
|
119
|
+
attributes[:description] || attributes[:desc]
|
128
120
|
end
|
129
121
|
alias_method :desc, :description
|
130
122
|
|
131
|
-
|
123
|
+
def _translate(*args)
|
124
|
+
return description if description.present?
|
125
|
+
super
|
126
|
+
end
|
127
|
+
|
128
|
+
def _translate_params
|
129
|
+
attributes
|
130
|
+
end
|
131
|
+
|
132
|
+
# user friendly message, for overid
|
133
|
+
def user_message
|
134
|
+
return description if description.present?
|
135
|
+
_translate
|
136
|
+
end
|
137
|
+
|
138
|
+
# another user friendly messages
|
132
139
|
def descriptions
|
133
140
|
return attributes[:descriptions] if attributes[:descriptions]
|
134
141
|
attributes[:descriptions] = {}
|
135
142
|
attributes[:descriptions]
|
136
143
|
end
|
137
144
|
|
145
|
+
# https://github.com/getsentry/sentry-ruby/blob/fbbc7a51ed10684d0e8b7bd9d2a1b65a7351c9ef/lib/raven/event.rb#L162
|
146
|
+
# sentry message use `to_s` method
|
147
|
+
# https://ruby-doc.org/core-2.5.1/Exception.html#method-i-to_s
|
148
|
+
alias to_origin_s to_s
|
149
|
+
|
150
|
+
def to_s
|
151
|
+
"#{_translate}\n#{to_origin_s}"
|
152
|
+
end
|
153
|
+
|
138
154
|
def to_hash
|
139
155
|
hash = attributes.merge(
|
140
156
|
type: self.class.name, status: status,
|
@@ -150,13 +166,6 @@ class StandardError
|
|
150
166
|
hash
|
151
167
|
end
|
152
168
|
|
153
|
-
def _translate_params
|
154
|
-
attributes.merge(
|
155
|
-
type: self.class.name, status: status,
|
156
|
-
http_status: http_status, message: message
|
157
|
-
)
|
158
|
-
end
|
159
|
-
|
160
169
|
def to_json
|
161
170
|
Oj.dump(to_hash.with_indifferent_access, mode: :compat)
|
162
171
|
end
|
@@ -204,13 +213,15 @@ class StandardError
|
|
204
213
|
def logging(options = {})
|
205
214
|
before_logging_blocks.values.each { |blk| instance_exec &blk }
|
206
215
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
216
|
+
if !report? || intentional?
|
217
|
+
if defined?(Rails)
|
218
|
+
return if Rails.env.test?
|
219
|
+
else
|
220
|
+
return
|
221
|
+
end
|
212
222
|
end
|
213
|
-
|
223
|
+
|
224
|
+
logger = options[:logger] || Coaster.logger
|
214
225
|
return unless logger
|
215
226
|
|
216
227
|
cl = options[:cleaner] || cleaner
|
@@ -228,7 +239,8 @@ class StandardError
|
|
228
239
|
else
|
229
240
|
logger.error(msg)
|
230
241
|
end
|
231
|
-
|
242
|
+
msg
|
243
|
+
ensure
|
232
244
|
after_logging_blocks.values.each { |blk| instance_exec &blk }
|
233
245
|
end
|
234
246
|
end
|
data/lib/coaster/version.rb
CHANGED
data/test/locales/en.yml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
en:
|
2
2
|
class:
|
3
|
+
StandardError:
|
4
|
+
self: 'standard error translation'
|
5
|
+
title: 'standard error title'
|
3
6
|
Coaster:
|
4
7
|
self: 'Coaster Translated'
|
5
8
|
SampleObject:
|
@@ -15,3 +18,4 @@ en:
|
|
15
18
|
title: 'Test this title'
|
16
19
|
sample:
|
17
20
|
title: 'Sample Title'
|
21
|
+
interpolation: 'Sample Interpolation %{value}'
|
data/test/test_helper.rb
CHANGED
@@ -37,6 +37,7 @@ module Coaster
|
|
37
37
|
def test_translation_sub
|
38
38
|
assert_equal 'Coaster SampleObject Title (class.Coaster.SampleObject.title)', SampleObject._translate('.title')
|
39
39
|
assert_equal 'Coaster SampleObject Title (class.Coaster.SampleObject.title)', SampleObject._translate(:title)
|
40
|
+
assert_nil SampleObject._translate(:title).instance_variable_get(:@missing)
|
40
41
|
end
|
41
42
|
|
42
43
|
def test_translation_with_key
|
@@ -46,6 +47,7 @@ module Coaster
|
|
46
47
|
def test_translation_inheritance
|
47
48
|
assert_equal 'Coaster SampleObject Translated', Inherited._translate
|
48
49
|
assert_equal 'Coaster SampleObject Title (class.Coaster.Inherited.title)', Inherited._translate(:title)
|
50
|
+
assert Inherited._translate.instance_variable_get(:@missing)
|
49
51
|
end
|
50
52
|
|
51
53
|
def test_interpolation
|
data/test/test_standard_error.rb
CHANGED
@@ -20,10 +20,91 @@ module Coaster
|
|
20
20
|
I18n.enforce_available_locales = false
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_standard_messages
|
24
|
+
e = StandardError.new('developer message')
|
25
|
+
assert_equal "standard error translation\ndeveloper message", e.to_s
|
26
|
+
assert_equal "standard error translation\ndeveloper message", e.message
|
27
|
+
assert_nil e.description
|
28
|
+
assert_nil e.desc
|
29
|
+
assert_equal 'standard error translation', e._translate
|
30
|
+
assert_equal 'standard error translation', e.user_message
|
31
|
+
assert_equal 'standard error title', e.title
|
32
|
+
e = StandardError.new(m: 'developer message', desc: 'user message')
|
33
|
+
assert_equal "user message\ndeveloper message", e.to_s
|
34
|
+
assert_equal "user message\ndeveloper message", e.message
|
35
|
+
assert_equal 'user message', e.description
|
36
|
+
assert_equal 'user message', e.desc
|
37
|
+
assert_equal 'user message', e._translate
|
38
|
+
assert_equal 'user message', e.user_message
|
39
|
+
assert_equal 'standard error title', e.title
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_no_translation_class
|
43
|
+
e = UntitledError.new('developer message')
|
44
|
+
assert_equal "standard error translation\ndeveloper message", e.to_s
|
45
|
+
assert_equal "standard error translation\ndeveloper message", e.message
|
46
|
+
assert_nil e.description
|
47
|
+
assert_nil e.desc
|
48
|
+
assert_equal 'standard error translation', e._translate
|
49
|
+
assert_equal 'standard error translation', e.user_message
|
50
|
+
assert_equal 'standard error title', e.title
|
51
|
+
e = UntitledError.new(m: 'developer message', desc: 'user message')
|
52
|
+
assert_equal "user message\ndeveloper message", e.to_s
|
53
|
+
assert_equal "user message\ndeveloper message", e.message
|
54
|
+
assert_equal 'user message', e.description
|
55
|
+
assert_equal 'user message', e.desc
|
56
|
+
assert_equal 'user message', e._translate
|
57
|
+
assert_equal 'user message', e.user_message
|
58
|
+
assert_equal 'standard error title', e.title
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_with_translation_class
|
62
|
+
e = SampleError.new
|
63
|
+
assert_equal "Test sample error\nCoaster::TestStandardError::SampleError", e.to_s
|
64
|
+
assert_equal "Test sample error\nCoaster::TestStandardError::SampleError", e.message
|
65
|
+
assert_nil e.description
|
66
|
+
assert_nil e.desc
|
67
|
+
assert_equal 'Test sample error', e._translate
|
68
|
+
assert_equal 'Test sample error', e.user_message
|
69
|
+
assert_equal 'Test this title', e.title
|
70
|
+
e = SampleError.new(beet: 'apple')
|
71
|
+
assert_equal "Test sample error\nCoaster::TestStandardError::SampleError", e.to_s
|
72
|
+
assert_equal "Test sample error\nCoaster::TestStandardError::SampleError", e.message
|
73
|
+
assert_nil e.description
|
74
|
+
assert_nil e.desc
|
75
|
+
assert_equal 'Test sample error', e._translate
|
76
|
+
assert_equal 'Test sample error', e.user_message
|
77
|
+
assert_equal 'Test this title', e.title
|
78
|
+
e = SampleError.new('developer message')
|
79
|
+
assert_equal "Test sample error\ndeveloper message", e.to_s
|
80
|
+
assert_equal "Test sample error\ndeveloper message", e.message
|
81
|
+
assert_nil e.description
|
82
|
+
assert_nil e.desc
|
83
|
+
assert_equal 'Test sample error', e._translate
|
84
|
+
assert_equal 'Test sample error', e.user_message
|
85
|
+
assert_equal 'Test this title', e.title
|
86
|
+
e = SampleError.new(m: 'developer message', desc: 'user message')
|
87
|
+
assert_equal "user message\ndeveloper message", e.to_s
|
88
|
+
assert_equal "user message\ndeveloper message", e.message
|
89
|
+
assert_equal 'user message', e.description
|
90
|
+
assert_equal 'user message', e.desc
|
91
|
+
assert_equal 'user message', e._translate
|
92
|
+
assert_equal 'user message', e.user_message
|
93
|
+
assert_equal 'Test this title', e.title
|
94
|
+
e = SampleError.new(tkey: 'sample.interpolation', value: 'blah')
|
95
|
+
assert_equal "Sample Interpolation blah\nCoaster::TestStandardError::SampleError", e.to_s
|
96
|
+
assert_equal "Sample Interpolation blah\nCoaster::TestStandardError::SampleError", e.message
|
97
|
+
assert_nil e.description
|
98
|
+
assert_nil e.desc
|
99
|
+
assert_equal 'Sample Interpolation blah', e._translate
|
100
|
+
assert_equal 'Sample Interpolation blah', e.user_message
|
101
|
+
assert_equal 'Test this title', e.title
|
102
|
+
end
|
103
|
+
|
23
104
|
def test_message
|
24
105
|
raise SampleError, {m: 'beer is proof'}
|
25
106
|
rescue => e
|
26
|
-
assert_equal
|
107
|
+
assert_equal "Test sample error\nbeer is proof", e.message
|
27
108
|
end
|
28
109
|
|
29
110
|
def test_attributes
|
@@ -39,16 +120,16 @@ module Coaster
|
|
39
120
|
raise ExampleError, {wat: 'cha'}
|
40
121
|
end
|
41
122
|
rescue => e
|
42
|
-
assert_equal e.to_hash['wat']
|
43
|
-
assert_equal e.to_hash['type']
|
44
|
-
assert_equal e.to_hash['status']
|
45
|
-
assert_equal e.to_hash['http_status']
|
46
|
-
assert_equal e.to_hash['message']
|
47
|
-
assert_equal e.to_hash['cause']['frog']
|
48
|
-
assert_equal e.to_hash['cause']['type']
|
49
|
-
assert_equal e.to_hash['cause']['status']
|
50
|
-
assert_equal e.to_hash['cause']['http_status']
|
51
|
-
assert_equal e.to_hash['cause']['message']
|
123
|
+
assert_equal 'cha', e.to_hash['wat']
|
124
|
+
assert_equal 'Coaster::TestStandardError::ExampleError', e.to_hash['type']
|
125
|
+
assert_equal 20, e.to_hash['status']
|
126
|
+
assert_equal 500, e.to_hash['http_status']
|
127
|
+
assert_equal "Test example error\nTest sample error\n#{SampleError.name}", e.to_hash['message']
|
128
|
+
assert_equal 'rams', e.to_hash['cause']['frog']
|
129
|
+
assert_equal 'Coaster::TestStandardError::SampleError', e.to_hash['cause']['type']
|
130
|
+
assert_equal 10, e.to_hash['cause']['status']
|
131
|
+
assert_equal 500, e.to_hash['cause']['http_status']
|
132
|
+
assert_equal "Test sample error\nCoaster::TestStandardError::SampleError", e.to_hash['cause']['message']
|
52
133
|
end
|
53
134
|
|
54
135
|
def test_cause_attributes
|
@@ -58,9 +139,9 @@ module Coaster
|
|
58
139
|
raise ExampleError, {wat: 'cha'}
|
59
140
|
end
|
60
141
|
rescue => e
|
61
|
-
assert_equal e.cause.attr['frog']
|
62
|
-
assert_equal e.attr['frog']
|
63
|
-
assert_equal e.attr['wat']
|
142
|
+
assert_equal 'rams', e.cause.attr['frog']
|
143
|
+
assert_equal 'rams', e.attr['frog']
|
144
|
+
assert_equal 'cha', e.attr['wat']
|
64
145
|
end
|
65
146
|
|
66
147
|
def test_to_detail
|
@@ -72,7 +153,9 @@ module Coaster
|
|
72
153
|
rescue => e
|
73
154
|
detail = <<-LOG
|
74
155
|
[Coaster::TestStandardError::ExampleError] status:20
|
75
|
-
MESSAGE: Test
|
156
|
+
MESSAGE: Test example error
|
157
|
+
Test sample error
|
158
|
+
Coaster::TestStandardError::SampleError
|
76
159
|
@fingerprint: []
|
77
160
|
@tags: {}
|
78
161
|
@level: \"error\"
|
@@ -81,6 +164,7 @@ module Coaster
|
|
81
164
|
@raven: {}
|
82
165
|
CAUSE: [Coaster::TestStandardError::SampleError] status:10
|
83
166
|
MESSAGE: Test sample error
|
167
|
+
Coaster::TestStandardError::SampleError
|
84
168
|
@fingerprint: []
|
85
169
|
@tags: {}
|
86
170
|
@level: \"error\"
|
@@ -94,19 +178,19 @@ LOG
|
|
94
178
|
def test_translation
|
95
179
|
raise SampleError, {tkey: '.test'}
|
96
180
|
rescue => e
|
97
|
-
assert_equal
|
181
|
+
assert_equal 'Test this translation', e._translate
|
98
182
|
end
|
99
183
|
|
100
184
|
def test_title
|
101
185
|
raise SampleError, 'foobar'
|
102
186
|
rescue => e
|
103
|
-
assert_equal
|
187
|
+
assert_equal 'Test this title', e.title
|
104
188
|
end
|
105
189
|
|
106
190
|
def test_title_missing
|
107
191
|
raise UntitledError, 'untitled'
|
108
192
|
rescue => e
|
109
|
-
|
193
|
+
assert_equal 'standard error title', e.title
|
110
194
|
end
|
111
195
|
|
112
196
|
def root_cause_sample1
|
@@ -129,35 +213,37 @@ LOG
|
|
129
213
|
begin
|
130
214
|
root_cause_sample3
|
131
215
|
rescue => e
|
132
|
-
assert_equal e.root_cause.message
|
216
|
+
assert_equal "standard error translation\na", e.root_cause.message
|
133
217
|
end
|
134
218
|
end
|
135
219
|
|
136
220
|
def test_raven_notes
|
137
221
|
raise SampleError, m: 'foofoo', something: 'other'
|
138
222
|
rescue => e
|
139
|
-
assert_equal e.notes(the_other: 'something')[:extra][:something]
|
140
|
-
assert_equal e.notes(the_other: 'something')[:extra][:the_other]
|
223
|
+
assert_equal 'other', e.notes(the_other: 'something')[:extra][:something]
|
224
|
+
assert_equal 'something', e.notes(the_other: 'something')[:extra][:the_other]
|
141
225
|
end
|
142
226
|
|
143
227
|
def test_to_hash
|
144
228
|
aa # raise NameError
|
145
229
|
rescue => e
|
146
|
-
assert_equal e.to_hash['type']
|
147
|
-
assert_equal e.to_hash['status']
|
148
|
-
assert_equal e.to_hash['http_status']
|
149
|
-
|
230
|
+
assert_equal 'NameError', e.to_hash['type']
|
231
|
+
assert_equal 999999, e.to_hash['status']
|
232
|
+
assert_equal 500, e.to_hash['http_status']
|
233
|
+
assert_match /undefined local variable or method `aa'/, e.to_hash['message']
|
150
234
|
end
|
151
235
|
|
152
236
|
def test_descriptions
|
153
237
|
raise SampleError
|
154
238
|
rescue => e
|
155
239
|
e.descriptions.merge!(a: 1)
|
156
|
-
assert_equal e.descriptions['a']
|
240
|
+
assert_equal 1, e.descriptions['a']
|
157
241
|
end
|
158
242
|
|
159
243
|
class SampleErrorSub < SampleError; end
|
160
|
-
class SampleErrorSubSub < SampleErrorSub
|
244
|
+
class SampleErrorSubSub < SampleErrorSub
|
245
|
+
def it_might_happen?; true end
|
246
|
+
end
|
161
247
|
SampleError.after_logging(:blah) do
|
162
248
|
self.attributes[:abc] = 100
|
163
249
|
@blah = 101
|
@@ -166,8 +252,8 @@ LOG
|
|
166
252
|
e = SampleErrorSubSub.new(m: 'foo')
|
167
253
|
assert !e.after_logging_blocks[:blah].nil?
|
168
254
|
e.logging
|
169
|
-
assert_equal e.attributes[:abc]
|
170
|
-
assert_equal e.instance_variable_get(:@blah)
|
255
|
+
assert_equal 100, e.attributes[:abc]
|
256
|
+
assert_equal 101, e.instance_variable_get(:@blah)
|
171
257
|
end
|
172
258
|
class SampleErrorMightHappen < SampleErrorSub
|
173
259
|
def it_might_happen?; true end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzz jung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 6.0.3.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 6.0.3.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: attr_extras
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,114 +70,72 @@ dependencies:
|
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.12'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.12'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.8'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.8'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry-stack_explorer
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.4'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.4'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: pry-byebug
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
73
|
+
- - ">="
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
75
|
+
version: '0'
|
118
76
|
type: :development
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
|
-
- - "
|
80
|
+
- - ">="
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
82
|
+
version: '0'
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
84
|
name: minitest
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
|
-
- - "
|
87
|
+
- - ">="
|
130
88
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
89
|
+
version: '0'
|
132
90
|
type: :development
|
133
91
|
prerelease: false
|
134
92
|
version_requirements: !ruby/object:Gem::Requirement
|
135
93
|
requirements:
|
136
|
-
- - "
|
94
|
+
- - ">="
|
137
95
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
96
|
+
version: '0'
|
139
97
|
- !ruby/object:Gem::Dependency
|
140
98
|
name: mocha
|
141
99
|
requirement: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
|
-
- - "
|
101
|
+
- - ">="
|
144
102
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
103
|
+
version: '0'
|
146
104
|
type: :development
|
147
105
|
prerelease: false
|
148
106
|
version_requirements: !ruby/object:Gem::Requirement
|
149
107
|
requirements:
|
150
|
-
- - "
|
108
|
+
- - ">="
|
151
109
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
110
|
+
version: '0'
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
112
|
name: shoulda
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
156
114
|
requirements:
|
157
|
-
- - "
|
115
|
+
- - ">="
|
158
116
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
117
|
+
version: '0'
|
160
118
|
type: :development
|
161
119
|
prerelease: false
|
162
120
|
version_requirements: !ruby/object:Gem::Requirement
|
163
121
|
requirements:
|
164
|
-
- - "
|
122
|
+
- - ">="
|
165
123
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
124
|
+
version: '0'
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
126
|
name: shoulda-context
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
170
128
|
requirements:
|
171
|
-
- - "
|
129
|
+
- - ">="
|
172
130
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
131
|
+
version: '0'
|
174
132
|
type: :development
|
175
133
|
prerelease: false
|
176
134
|
version_requirements: !ruby/object:Gem::Requirement
|
177
135
|
requirements:
|
178
|
-
- - "
|
136
|
+
- - ">="
|
179
137
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
138
|
+
version: '0'
|
181
139
|
description: Ruby Core Extensions
|
182
140
|
email: buzz@frograms.com
|
183
141
|
executables: []
|
@@ -221,12 +179,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
179
|
- !ruby/object:Gem::Version
|
222
180
|
version: '0'
|
223
181
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.1.2
|
225
183
|
signing_key:
|
226
184
|
specification_version: 4
|
227
185
|
summary: A little convenient feature for standard library
|
228
186
|
test_files:
|
229
187
|
- test/test_object_translation.rb
|
230
|
-
- test/locales/en.yml
|
231
|
-
- test/test_standard_error.rb
|
232
188
|
- test/test_helper.rb
|
189
|
+
- test/test_standard_error.rb
|
190
|
+
- test/locales/en.yml
|