Class: Mago::Cli::FileFinder
- Inherits:
-
Object
- Object
- Mago::Cli::FileFinder
- Defined in:
- lib/mago/cli/file_finder.rb
Overview
Finds ruby files in local file system.
Instance Method Summary collapse
-
#find ⇒ Array<String>
Find ruby files.
-
#initialize(paths) ⇒ FileFinder
constructor
A new instance of FileFinder.
Constructor Details
#initialize(paths) ⇒ FileFinder
Returns a new instance of FileFinder.
6 7 8 |
# File 'lib/mago/cli/file_finder.rb', line 6 def initialize(paths) @paths = paths end |
Instance Method Details
#find ⇒ Array<String>
Find ruby files.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mago/cli/file_finder.rb', line 13 def find ruby_files = [] @paths.each do |path| if File.directory?(path) pattern = File.join(path, '/**/*.rb') ruby_files.concat(Dir[pattern]) else ruby_files << path end end ruby_files end |