lib/bigfiles/source_code_finder.rb in bigfiles-0.0.2 vs lib/bigfiles/source_code_finder.rb in bigfiles-0.0.3

- old
+ new

@@ -1,20 +1,16 @@ require 'find' module BigFiles # Finds source code files in the current directory class SourceCodeFinder - def initialize(filefind: Find) + def initialize(filefind: Find, + globber: Dir) @filefind = filefind + @globber = globber end - def find - files = [] - @filefind.find('.') do |path| - files << path if path =~ /.*\.rb$/ || path =~ /.*\.swift$/ - end - files.map do |filename| - filename.sub(/^.\//, '') - end + def find(glob) + @globber.glob(glob) end end end