coaster 1.0.2 → 1.0.3

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
2
  SHA256:
3
- metadata.gz: 388b2f2f69156f7344ddd198dc1a68a6a41c886db2dc23b881576ca06e48ad80
4
- data.tar.gz: 45e1be2338d2fb185bfa6c7652d0e82a0342a961911503f6af133b0bfbcf6c66
3
+ metadata.gz: df1ca619424ece483c0dc2dd1f6ae0fde7c725752ab5593b8c0219baf219a4ea
4
+ data.tar.gz: 465e303a6d645d934df100415de58202fbc09cdccc3ebe27eee9a519c6d58ae4
5
5
  SHA512:
6
- metadata.gz: d35ee060873032921e4c165e529b99314e1115c083c3d616b5250975819c536f47df1b3c0de40272a990414273910f427013e5ff2d2705f3d807c87fd7cbf617
7
- data.tar.gz: ccbd4fca13b51857c45ea9e5772375bc2019ba3cfcb5c730c54981618205a50f6e2f6bbfd2f51c2582977ad61703d19a70cd7ca71a0d4c382c7d5790c15f8c3c
6
+ metadata.gz: 0c091ac873ec7798bf4e7d412184474a8c9d528fe1c654dd1034f3b997938453976f69465d32a5c3ac5340ae468e15c33d84de905790901964cdf969dc6d1e88
7
+ data.tar.gz: f7b9c0f618501191fa8f1c881cf41a03c0304f5d14b1163bc38d986b1321bd7c41048085756133e3654c75b41bf9d51c25292e5e2a7709e483d6c754443e09cd
@@ -39,13 +39,13 @@ class Object
39
39
  end
40
40
 
41
41
  if result.is_a?(I18n::MissingTranslation)
42
- Coaster.logger && Coaster.logger.warn(result)
43
42
  unless options.key?(:original_missing)
44
43
  options.merge!(original_missing: result)
45
44
  end
46
45
 
47
46
  if key_class.superclass == Object || key_class == Object
48
47
  return options[:description] if options[:description].present?
48
+ Coaster.logger && Coaster.logger.warn(result)
49
49
  throw :exception, result if options[:original_throw]
50
50
  missing = options[:original_missing] || result
51
51
  msg = missing.message
@@ -115,6 +115,13 @@ class StandardError
115
115
  end
116
116
  alias_method :desc, :description
117
117
 
118
+ # more user friendly messages
119
+ def descriptions
120
+ return attributes[:descriptions] if attributes[:descriptions]
121
+ attributes[:descriptions] = {}
122
+ attributes[:descriptions]
123
+ end
124
+
118
125
  def object
119
126
  attributes[:object] || attributes[:obj]
120
127
  end
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -148,5 +148,12 @@ LOG
148
148
  assert_equal e.to_hash['http_status'], 500
149
149
  assert e.to_hash['message'] =~ /undefined local variable or method `aa'/
150
150
  end
151
+
152
+ def test_descriptions
153
+ raise SampleError
154
+ rescue => e
155
+ e.descriptions.merge!(a: 1)
156
+ assert_equal e.descriptions['a'], 1
157
+ end
151
158
  end
152
159
  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.2
4
+ version: 1.0.3
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-02-10 00:00:00.000000000 Z
11
+ date: 2020-07-07 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/locales/en.yml
230
- - test/test_standard_error.rb
231
229
  - test/test_helper.rb
230
+ - test/test_standard_error.rb
231
+ - test/locales/en.yml
232
232
  - test/test_object_translation.rb