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
-
#initialize(pattern, checkers) ⇒ Visitor
constructor
A new instance of Visitor.
- #prepare ⇒ Object
- #render ⇒ 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
#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 |
#render ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/guideline/visitor.rb', line 28 def render errors.group_by(&:path).each do |path, errors| puts path errors.sort_by(&:line).each(&:render) puts 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 |