Class: ActiveRecordScanner::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(glob, options = {}) ⇒ Scanner

Returns a new instance of Scanner.



7
8
9
10
11
# File 'lib/active_record_scanner.rb', line 7

def initialize(glob, options={})
  @glob = glob
  @options = options
  @results = []
end

Instance Method Details

#scanObject



13
14
15
16
17
18
19
20
21
# File 'lib/active_record_scanner.rb', line 13

def scan
  Dir.glob(@glob).each do |file|
    print "." unless @options[:silent]
    @file = file
    raw = IO.binread(file)
    scan_file(raw)
  end
  @results
end

#scan_file(raw) ⇒ Object



23
24
25
26
27
# File 'lib/active_record_scanner.rb', line 23

def scan_file(raw)
  compact_tree = Parser.new(raw).parse
  scan_for_errors(compact_tree)
  @results
end