Class: Js::Preflight::Scanner
- Inherits:
-
Object
- Object
- Js::Preflight::Scanner
- Defined in:
- lib/js-preflight/scanner.rb
Class Method Summary collapse
Class Method Details
.scan(file, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/js-preflight/scanner.rb', line 5 def scan(file, = {}) exclude_paths = [:exclude_paths] || [] file = File.open(file, "r") unless file.kind_of?(File) while line = file.gets do line.scan(::Js::Preflight::JsRegexp).each do |js_file| yield js_file[0] unless exclude_paths.any? { |p| js_file[0].match(p) } end end end |