coaster 0.1.2 → 0.1.4

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
  SHA1:
3
- metadata.gz: 21812083028d71953c74456cf8b8894b0a4eb369
4
- data.tar.gz: 78de02ddd0825583b846adbd474e1e697a092e3a
3
+ metadata.gz: 95f0cfd9af5c9ff9cbceb4b658f70bf32f02220b
4
+ data.tar.gz: d3e9b6913e609cd6ccf231808cf6e64d5a619389
5
5
  SHA512:
6
- metadata.gz: 8689c98beac5d6848c30173efdffa8bdffdcf5d79386a50677d9d7090f4017c4e16644e274495b44e214198b93ac0b071c18427c3863ca75a1b296a74f0cfc32
7
- data.tar.gz: cdce5cd7c248d8e6088da46bbdef84d94726e1a32561e17e6b2def0f34fe3a826e1375871c2a9cdc09a2c81b14e4c3e7c5ffbdecbdc1d18a4970f840ee0fef4b
6
+ metadata.gz: 71bac4518e829fd11a28a75ca4d1b2c3407ed41b6b47eed1e051d565c4e855818db0f6576c73fe744d739f4a62080f55a204c3493df108e532c4b9fc21f872d8
7
+ data.tar.gz: 244a8da9cfc50a2125ac44193f130071d41343a94128225e59e8264c9d81082338227c11290c58ffccc15d2f1b79d989a659cbacd123626f0c44033d2de7d096
@@ -14,6 +14,11 @@ class StandardError
14
14
  def http_status
15
15
  500
16
16
  end
17
+
18
+ def title
19
+ t = _translate('.title')
20
+ t.instance_variable_get(:@missing) ? nil : t
21
+ end
17
22
  end
18
23
 
19
24
  attr_accessor :tags, :level, :tkey
@@ -63,6 +68,10 @@ class StandardError
63
68
  self.class.status
64
69
  end
65
70
 
71
+ def title
72
+ self.class.title
73
+ end
74
+
66
75
  def attributes
67
76
  if cause && cause.respond_to?(:attributes)
68
77
  cause.attributes.merge(@attributes)
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.4'
3
3
  end
data/test/locales/en.yml CHANGED
@@ -8,5 +8,6 @@ en:
8
8
  TestStandardError:
9
9
  SampleError:
10
10
  test: 'Test this translation'
11
+ title: 'Test this title'
11
12
  sample:
12
13
  title: 'Sample Title'
@@ -11,6 +11,8 @@ module Coaster
11
11
  def self.status; 20 end
12
12
  end
13
13
 
14
+ class UntitledError < StandardError; end
15
+
14
16
  def setup
15
17
  I18n.backend = I18n::Backend::Simple.new
16
18
  I18n.load_path += [File.expand_path('../locales/en.yml', __FILE__)]
@@ -91,5 +93,17 @@ LOG
91
93
  rescue => e
92
94
  assert_equal e._translate, 'Test this translation'
93
95
  end
96
+
97
+ def test_title
98
+ raise SampleError, 'foobar'
99
+ rescue => e
100
+ assert_equal e.title, 'Test this title'
101
+ end
102
+
103
+ def test_title_missing
104
+ raise UntitledError, 'untitled'
105
+ rescue => e
106
+ assert_equal e.title, nil
107
+ end
94
108
  end
95
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - buzz jung