lib/directory_searcher.rb in markdown_exec-2.3.0 vs lib/directory_searcher.rb in markdown_exec-2.4.0
- old
+ new
@@ -153,14 +153,16 @@
@paths.each do |path|
Find.find(path) do |p|
Find.prune unless @include_subdirectories || path == p
next unless File.file?(p)
- next if @filename_glob && !File.fnmatch(@filename_glob, File.basename(p))
+ next if @filename_glob && !File.fnmatch(@filename_glob,
+ File.basename(p))
begin
File.foreach(p).with_index(1) do |line, line_num| # Index starts from 1 for line numbers
- line_utf8 = line.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')
+ line_utf8 = line.encode('UTF-8', invalid: :replace,
+ undef: :replace, replace: '')
line_utf8 = yield(line_utf8) if block_given?
if line_utf8&.match?(@pattern)
match_details[p] ||= []