Method: PDD::Rule::Text::MinWords#errors

Defined in:
lib/pdd/rule/text.rb

#errorsObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/pdd/rule/text.rb', line 16

def errors
  @xml.xpath('//puzzle').map do |p|
    words = p.xpath('body/text()').to_s.split.size
    next nil if words >= @min

    "Puzzle #{p.xpath('file/text()')}:#{p.xpath('lines/text()')} " \
      "has a very short description of just #{words} words while " \
      "a minimum of #{@min} is required"
  end.compact
end