Class: Uniword::Template::TemplateValidator
- Inherits:
-
Object
- Object
- Uniword::Template::TemplateValidator
- Defined in:
- lib/uniword/template/template_validator.rb
Overview
Validates template structure and syntax.
Checks for common template errors:
-
Unclosed loops ({@each} without {@end})
-
Unclosed conditionals ({@if} without {@end})
-
Mismatched nesting
-
Invalid syntax
Responsibility: Template validation only Single Responsibility Principle: Does NOT parse or render
Instance Method Summary collapse
-
#initialize(template) ⇒ TemplateValidator
constructor
Initialize validator.
-
#validate ⇒ Array<String>
Validate template.
Constructor Details
#initialize(template) ⇒ TemplateValidator
Initialize validator
27 28 29 30 |
# File 'lib/uniword/template/template_validator.rb', line 27 def initialize(template) @template = template @errors = [] end |
Instance Method Details
#validate ⇒ Array<String>
Validate template
35 36 37 38 39 40 41 42 43 |
# File 'lib/uniword/template/template_validator.rb', line 35 def validate @errors = [] validate_loop_nesting validate_conditional_nesting validate_marker_syntax @errors end |