Class: Uniword::Lint::BuiltinRules::RequireBody
- Defined in:
- lib/uniword/lint/builtin_rules/require_body.rb
Overview
Rule: documents must have a non-empty body.
Constant Summary
Constants inherited from Rule
Instance Attribute Summary
Attributes inherited from Rule
Instance Method Summary collapse
Methods inherited from Rule
#finding, #initialize, register, type, types
Constructor Details
This class inherits a constructor from Uniword::Lint::Rule
Instance Method Details
#check(document) {|finding( message: "Document body is empty", path: "word/document.xml", )| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/uniword/lint/builtin_rules/require_body.rb', line 10 def check(document) body = document.body paragraphs = body&.paragraphs || [] return if paragraphs.any? yield finding( message: "Document body is empty", path: "word/document.xml", ) end |