code_reaper 0.0.1 → 0.0.3

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.
@@ -2,8 +2,8 @@ module CodeReaper
2
2
  class Directory
3
3
  attr_reader :dirname, :files
4
4
 
5
- def initialize(dirname, options={}, input = ::Dir)
6
- unless input.exist?(dirname)
5
+ def initialize(dirname, options={})
6
+ unless ::File.directory?(dirname)
7
7
  raise InvalidDirectory, dirname
8
8
  end
9
9
 
@@ -14,7 +14,7 @@ module CodeReaper
14
14
  def strip regex
15
15
  files.map do |file|
16
16
  striped = File.new(file).strip regex
17
- block_given? ? yield(striped) : striped
17
+ block_given? ? yield(file, striped) : striped
18
18
  end
19
19
  end
20
20
 
@@ -25,19 +25,18 @@ module CodeReaper
25
25
  end
26
26
 
27
27
  def load_files options={}
28
- @files = Dir["#{dirname}/**/**"]
28
+ @files = ::Dir["#{dirname}/**/**"]
29
29
  select_files options[:only]
30
30
  reject_files options[:except]
31
31
  end
32
32
 
33
33
  def select_files(regex)
34
- return files unless regex
35
- files.select! { |file| file =~ regex }
34
+ files.select! { |file| ::File.file? file }
35
+ files.select! { |file| file =~ regex } if regex
36
36
  end
37
37
 
38
38
  def reject_files(regex)
39
- return files unless regex
40
- files.reject! { |file| file =~ regex }
39
+ files.reject! { |file| file =~ regex } if regex
41
40
  end
42
41
  end
43
42
 
@@ -1,3 +1,3 @@
1
1
  module CodeReaper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_reaper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: 2676411933027878250
69
+ hash: 345460464109858554
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: 2676411933027878250
78
+ hash: 345460464109858554
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24