lib/ahnnotate/vfs.rb in ahnnotate-0.2.0 vs lib/ahnnotate/vfs.rb in ahnnotate-0.3.0
- old
+ new
@@ -40,11 +40,11 @@
end
@driver.each(&Proc.new)
end
- def each_in(paths)
+ def each_in(paths, extensions = [])
if !block_given?
return enum_for(:each_in, paths)
end
paths =
@@ -52,10 +52,20 @@
paths
else
[paths]
end
- @driver.each_in(paths, &Proc.new)
+ extensions = [extensions].flatten.compact
+
+ @driver.each_in(paths) do |path, content|
+ if extensions.any?
+ if !extensions.include?(File.extname(path))
+ next
+ end
+ end
+
+ yield(path, content)
+ end
end
private
def accessible_path?(path)