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.


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

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

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.


3
4
5
# File 'lib/recog/verifier.rb', line 3

def db
  @db
end

#reporterObject (readonly)

Returns the value of attribute reporter.


3
4
5
# File 'lib/recog/verifier.rb', line 3

def reporter
  @reporter
end

Instance Method Details

#verifyObject


10
11
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
# File 'lib/recog/verifier.rb', line 10

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 "WARN: #{message}"
        when :fail
          reporter.failure "FAIL: #{message}"
        when :success
          reporter.success(message)
        end
      end
      fp.verify_tests do |status, message|
        case status
        when :warn
          reporter.warning "WARN: #{message}"
        when :fail
          reporter.failure "FAIL: #{message}"
        when :success
          reporter.success(message)
        end
      end
    end
  end
end