coaster 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coaster/core_ext/standard_error.rb +12 -2
- data/lib/coaster/version.rb +1 -1
- data/test/test_standard_error.rb +12 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca45b5184489708bdeeb0381f2d540576f1b58cc324b3dca4f5bd698f021c687
|
4
|
+
data.tar.gz: 69ab2837c8159634389fefc993503c130bb8e14efcda3a2621646d909a3f9a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 417805608b285316128c95f4aadaa83d26ab9f2666e0273e1ee987baca5b4d346596dd0d1d8de925f7273bf6a4ee3ac057ceaf43c6213874b025e9df51533c5f
|
7
|
+
data.tar.gz: 795b2a27aaadf52aad1e6f723397dc13be68e3cd7028ca5c1a982cd9dda6cbe92d688ea4324ed72fd609274993c91c29978bf0d2ecc52bad7b4d6a82c68b4341
|
@@ -102,8 +102,18 @@ class StandardError
|
|
102
102
|
def code; attributes[:code] || status end
|
103
103
|
def code=(value); attributes[:code] = value end
|
104
104
|
def title; attributes[:title] || self.class.title end
|
105
|
-
def
|
106
|
-
def
|
105
|
+
def it_might_happen?; attributes[:it] == :might_happen end
|
106
|
+
def it_should_not_happen?; attributes[:it] == :should_not_happen end
|
107
|
+
def report?
|
108
|
+
return attributes[:report] if attributes.key?(:report)
|
109
|
+
return false if it_might_happen?
|
110
|
+
self.class.report?
|
111
|
+
end
|
112
|
+
def intentional? # not logging in test
|
113
|
+
return attributes[:intentional] if attributes.key?(:intentional)
|
114
|
+
return true if it_should_not_happen?
|
115
|
+
self.class.intentional?
|
116
|
+
end
|
107
117
|
def object; attributes[:object] || attributes[:obj] end
|
108
118
|
alias_method :obj, :object
|
109
119
|
|
data/lib/coaster/version.rb
CHANGED
data/test/test_standard_error.rb
CHANGED
@@ -158,12 +158,23 @@ LOG
|
|
158
158
|
|
159
159
|
class SampleErrorSub < SampleError; end
|
160
160
|
class SampleErrorSubSub < SampleErrorSub; end
|
161
|
-
SampleError.after_logging(:blah)
|
161
|
+
SampleError.after_logging(:blah) do
|
162
|
+
self.attributes[:abc] = 100
|
163
|
+
@blah = 101
|
164
|
+
end
|
162
165
|
def test_before_logging
|
163
166
|
e = SampleErrorSubSub.new(m: 'foo')
|
164
167
|
assert !e.after_logging_blocks[:blah].nil?
|
165
168
|
e.logging
|
169
|
+
assert_equal e.attributes[:abc], 100
|
166
170
|
assert_equal e.instance_variable_get(:@blah), 101
|
167
171
|
end
|
172
|
+
class SampleErrorMightHappen < SampleErrorSub
|
173
|
+
def it_might_happen?; true end
|
174
|
+
end
|
175
|
+
def test_might_happen
|
176
|
+
e = SampleErrorMightHappen.new('fbar')
|
177
|
+
assert !e.report?
|
178
|
+
end
|
168
179
|
end
|
169
180
|
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.0.7
|
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-09-
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -226,7 +226,7 @@ signing_key:
|
|
226
226
|
specification_version: 4
|
227
227
|
summary: A little convenient feature for standard library
|
228
228
|
test_files:
|
229
|
+
- test/test_object_translation.rb
|
229
230
|
- test/locales/en.yml
|
230
231
|
- test/test_standard_error.rb
|
231
232
|
- test/test_helper.rb
|
232
|
-
- test/test_object_translation.rb
|