acts_as_sweepable 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('acts_as_sweepable', '0.2.0') do |p|
5
+ Echoe.new('acts_as_sweepable', '0.2.1') do |p|
6
6
  p.description = "Adds a class method called sweep to ActiveRecord - used to remove old elements"
7
7
  p.url = "https://github.com/mensfeld/Acts-as-Sweepable"
8
8
  p.author = "Maciej Mensfeld"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "acts_as_sweepable"
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Maciej Mensfeld"]
@@ -39,10 +39,18 @@ module Acts
39
39
  # Run on each block of code
40
40
  if block_given?
41
41
  els = self.where("#{statement} #{conditions}")
42
- els.each {|el| yield el }
42
+ els.find_each {|el| yield el }
43
43
  end
44
44
 
45
- self.send(remove_method, "#{statement} #{conditions}")
45
+ res = self.send(remove_method, "#{statement} #{conditions}")
46
+ case res
47
+ when Integer
48
+ res
49
+ when nil
50
+ 0
51
+ when Array
52
+ res.length
53
+ end
46
54
  end
47
55
  end
48
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_sweepable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &7499640 !ruby/object:Gem::Requirement
16
+ requirement: &20441820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *7499640
24
+ version_requirements: *20441820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mocha
27
- requirement: &7498720 !ruby/object:Gem::Requirement
27
+ requirement: &20438860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *7498720
35
+ version_requirements: *20438860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_record
38
- requirement: &7495540 !ruby/object:Gem::Requirement
38
+ requirement: &20437780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *7495540
46
+ version_requirements: *20437780
47
47
  description: Adds a class method called sweep to ActiveRecord - used to remove old
48
48
  elements
49
49
  email: maciej@mensfeld.pl