Class: Recog::Verifier

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db, reporter) ⇒ Verifier

Returns a new instance of Verifier.



7
8
9
10
# File 'lib/recog/verifier.rb', line 7

def initialize(db, reporter)
  @db = db
  @reporter = reporter
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



5
6
7
# File 'lib/recog/verifier.rb', line 5

def db
  @db
end

#reporterObject (readonly)

Returns the value of attribute reporter.



5
6
7
# File 'lib/recog/verifier.rb', line 5

def reporter
  @reporter
end

Instance Method Details

#verifyObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/recog/verifier.rb', line 12

def verify
  reporter.report(db.fingerprints.count) do
    db.fingerprints.each do |fp|
      reporter.print_name fp

      fp.verify_params do |status, message|
        case status
        when :warn
          reporter.warning message, fp.line
        when :fail
          reporter.failure message, fp.line
        when :success
          reporter.success(message)
        end
      end
      fp.verify_tests do |status, message|
        case status
        when :warn
          reporter.warning message, fp.line
        when :fail
          reporter.failure message, fp.line
        when :success
          reporter.success(message)
        end
      end
    end
  end
end