Class: Guideline::Visitor
- Inherits:
-
Object
- Object
- Guideline::Visitor
- Defined in:
- lib/guideline/visitor.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(pattern, checkers) ⇒ Visitor
constructor
A new instance of Visitor.
- #prepare ⇒ Object
- #visit ⇒ Object
Constructor Details
#initialize(pattern, checkers) ⇒ Visitor
Returns a new instance of Visitor.
7 8 9 10 |
# File 'lib/guideline/visitor.rb', line 7 def initialize(pattern, checkers) @pattern = pattern @checkers = checkers end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/guideline/visitor.rb', line 5 def @options end |
Instance Method Details
#errors ⇒ Object
28 29 30 |
# File 'lib/guideline/visitor.rb', line 28 def errors @errors ||= checkers.select(&:has_error?).map(&:errors).inject([], &:+) end |
#prepare ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/guideline/visitor.rb', line 20 def prepare paths.each do |path| checkers.each do |checker| checker.prepare(path) if checker.respond_to?(:prepare) end end end |
#visit ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/guideline/visitor.rb', line 12 def visit paths.each do |path| checkers.each do |checker| checker.check(path) end end end |