errawr 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/errawr/version.rb +1 -1
- data/lib/errawr.rb +14 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c2fadb4eff97c1bafc486e133cde46212e9e95
|
4
|
+
data.tar.gz: 8fb4779905ee0bf0b775dab0813448bb6517a645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48133d652dd5ec6aff7a6ecf61a918aecdfda5a26e80c8f65e8572eb4ee9bcf80488a00fa46aec3bf2a1109043303ef877ebcd3fe6be102547726c35dac72135
|
7
|
+
data.tar.gz: 419abca48b2a0ec5022b601301ad09549eebe53ace31c53464f854d102f9c97d536222dd3653fcc0a5eacef88bb5b90e6d9bd569c67d2fe1a7931047f83e0c89
|
data/lib/errawr/version.rb
CHANGED
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.
|
12
|
-
|
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
|
-
|
19
|
-
|
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
|