dm-noisy-failures 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,24 +4,24 @@ module DataMapper
4
4
  alias_method :destroy?, :destroy
5
5
 
6
6
  def save
7
- unless self.save?
8
- return if self.errors.empty?
9
- error_message = self.errors.map { |e| "#{self.class}: #{e.join(', ')}" }.join("; ")
10
- raise SaveFailureError.new(error_message, self)
11
- end
7
+ return if self.save? || self.errors.empty?
8
+ error_message = self.errors.map { |e| "#{self.class}: #{e.join(', ')}" }.join("; ")
9
+ raise SaveFailureError.new(error_message, self)
12
10
  end
13
11
 
14
12
  def destroy
15
- unless self.destroy?
16
- error_message = "#{self.class}: Unable to destroy, probably due to associated records."
17
- raise SaveFailureError.new(error_message, self)
18
- end
13
+ return if self.destroy?
14
+ error_message = "#{self.class}: Unable to destroy, probably due to associated records."
15
+ raise SaveFailureError.new(error_message, self)
19
16
  end
20
17
 
21
18
  def update?(*args)
22
19
  self.update(*args)
23
20
  true
24
21
  rescue => e
22
+ # This seems like the cleanest way of doing this. #update calls #save internally, so we can't
23
+ # use alias_method because then #update? would call #save, which would raise an exception now
24
+ # that we've done our monkey-patching.
25
25
  false
26
26
  end
27
27
 
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module NoisyFailures
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -1 +1,2 @@
1
+ require "data_mapper"
1
2
  require "data_mapper/noisy_failures"
metadata CHANGED
@@ -1,87 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dm-noisy-failures
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Daniel Tao
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-01-28 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: data_mapper
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- description: |
36
- This library replaces the default behavior of DataMapper by raising exceptions with
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ! 'This library replaces the default behavior of DataMapper by raising
31
+ exceptions with
32
+
37
33
  descriptive error messages whenever DB operations are not successfully completed.
38
34
 
39
- email:
35
+ '
36
+ email:
40
37
  - daniel.tao@gmail.com
41
38
  executables: []
42
-
43
39
  extensions: []
44
-
45
40
  extra_rdoc_files: []
46
-
47
- files:
41
+ files:
42
+ - lib/dm_noisy_failures.rb
48
43
  - lib/data_mapper/noisy_failures/version.rb
49
44
  - lib/data_mapper/noisy_failures.rb
50
45
  - lib/dm-noisy-failures.rb
51
- - lib/dm_noisy_failures.rb
52
- has_rdoc: true
53
46
  homepage: http://github.com/dtao/dm-noisy-failures
54
47
  licenses: []
55
-
56
48
  post_install_message:
57
49
  rdoc_options: []
58
-
59
- require_paths:
50
+ require_paths:
60
51
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
52
+ required_ruby_version: !ruby/object:Gem::Requirement
62
53
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
59
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
79
64
  requirements: []
80
-
81
65
  rubyforge_project:
82
- rubygems_version: 1.4.2
66
+ rubygems_version: 1.8.25
83
67
  signing_key:
84
68
  specification_version: 3
85
69
  summary: Noisy (and descriptive) failures for DataMapper
86
70
  test_files: []
87
-