class ScanApp
Constants
- ALLOWED_EXTENSIONS
- EXCLUDE_FOLDERS
Public Class Methods
call(path, except, only)
click to toggle source
# File lib/scan_app.rb, line 6 def call(path, except, only) @except = except @only = only # list of all files from app dir recursively @project_files = Dir.glob("#{path}/**/*") filter_by_extension exclude_default exclude_files if @except include_only_files if @only @project_files end
Private Class Methods
exclude_default()
click to toggle source
# File lib/scan_app.rb, line 22 def exclude_default @project_files = @project_files.reject { |project_file| match?(project_file, EXCLUDE_FOLDERS) } end
exclude_files()
click to toggle source
# File lib/scan_app.rb, line 30 def exclude_files @project_files = @project_files.reject { |project_file| match?(project_file, @except) } end
filter_by_extension()
click to toggle source
# File lib/scan_app.rb, line 26 def filter_by_extension @project_files = @project_files.select { |project_file| project_file.end_with?(*ALLOWED_EXTENSIONS) } end
include_only_files()
click to toggle source
# File lib/scan_app.rb, line 34 def include_only_files @project_files = @project_files.select { |project_file| match?(project_file, @only) } end
match?(string, matches)
click to toggle source
# File lib/scan_app.rb, line 38 def match?(string, matches) matches.any? { |item| string.include?(item) } end