Class: Checkable::Checker

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(focus = NoFocus) ⇒ Checker

Returns a new instance of Checker.



51
52
53
54
# File 'lib/checkable.rb', line 51

def initialize focus=NoFocus
  @focus = focus
  @reports = []
end

Instance Attribute Details

#focusObject

Returns the value of attribute focus.



49
50
51
# File 'lib/checkable.rb', line 49

def focus
  @focus
end

#reportsObject

Returns the value of attribute reports.



49
50
51
# File 'lib/checkable.rb', line 49

def reports
  @reports
end

Instance Method Details

#check(object) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/checkable.rb', line 56

def check object
  report = Report.new object
  checks = Checkable.checks_for object.class.name
  checks.each { |check|
    report.run check if @focus.enabled?(check)
  }
  @reports << report
end