errawr 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/errawr/version.rb +1 -1
  3. data/lib/errawr.rb +14 -7
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53dd33fcc53f56b3de440b033ace97f719547cdf
4
- data.tar.gz: 48b204380c5b9dea3e414e61d8c94ba59cc759dc
3
+ metadata.gz: 18c2fadb4eff97c1bafc486e133cde46212e9e95
4
+ data.tar.gz: 8fb4779905ee0bf0b775dab0813448bb6517a645
5
5
  SHA512:
6
- metadata.gz: 106bc7b7a9e02650e7a9eae8ad6f1e9eadfd75c43b70209d25bffa0ca6cad72a61b300adfde1323b0a8cbd32065ddf678d492a5145f96e35c49124a1f5cb5f3b
7
- data.tar.gz: 5822e9d8bfddfec2b1088b221628cc7759d735c0e6119bca7446d88250d3d721c3a3e4697d156f4424ad69ec603ee462fd7b6bb3dae1c274dc68aa514150ebde
6
+ metadata.gz: 48133d652dd5ec6aff7a6ecf61a918aecdfda5a26e80c8f65e8572eb4ee9bcf80488a00fa46aec3bf2a1109043303ef877ebcd3fe6be102547726c35dac72135
7
+ data.tar.gz: 419abca48b2a0ec5022b601301ad09549eebe53ace31c53464f854d102f9c97d536222dd3653fcc0a5eacef88bb5b90e6d9bd569c67d2fe1a7931047f83e0c89
@@ -1,3 +1,3 @@
1
1
  module Errawr
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
data/lib/errawr.rb CHANGED
@@ -8,14 +8,21 @@ module Errawr
8
8
  I18n.load_path += Dir.glob('lib/errawr/locales/*.{rb,yml}')
9
9
  I18n.reload!
10
10
 
11
- def self.error!(name, context = {})
12
- klass = Mapper[name] || Mapper[:unknown]
13
- klass.metadata.merge!(context.delete(:metadata) || {})
14
- klass.context.merge!(context)
15
- raise klass
11
+ def self.included(base)
12
+ base.extend(ClassMethods)
16
13
  end
17
14
 
18
- def self.register!(key, options = {})
19
- Mapper.register!(key, options)
15
+ module ClassMethods
16
+ def error!(name, context = {})
17
+ klass = Mapper[name] || Mapper[:unknown]
18
+ klass.metadata.merge!(context.delete(:metadata) || {})
19
+ klass.context.merge!(context)
20
+ raise klass
21
+ end
22
+
23
+ def register!(key, options = {})
24
+ Mapper.register!(key, options)
25
+ end
20
26
  end
27
+ extend ClassMethods
21
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errawr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Smith