errogant 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/errogant.rb +13 -6
- metadata +4 -4
data/lib/errogant.rb
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
module Errogant
|
2
2
|
|
3
|
-
VERSION = '0.0.
|
3
|
+
VERSION = '0.0.7'
|
4
4
|
|
5
5
|
def self.included(included_by)
|
6
|
-
included_by.send(:cattr_accessor,:
|
6
|
+
included_by.send(:cattr_accessor,:__error_map)
|
7
|
+
included_by.send(:extend,ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def map_errors(error_hash)
|
12
|
+
self.__error_map = error_hash
|
13
|
+
end
|
7
14
|
end
|
8
15
|
|
9
16
|
def pretty_errors
|
10
17
|
output = []
|
11
|
-
errors.each do |
|
12
|
-
if
|
13
|
-
output.push
|
18
|
+
errors.full_messages.each do |error_msg|
|
19
|
+
if self.class.__error_map[error_msg]
|
20
|
+
output.push self.class.__error_map[error_msg]
|
14
21
|
else
|
15
|
-
output.push
|
22
|
+
output.push error_msg
|
16
23
|
end
|
17
24
|
end
|
18
25
|
output
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errogant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Zack Parker
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-02 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|