Class: PDD::Rule::Estimate::Max

Inherits:
Object
  • Object
show all
Defined in:
lib/pdd/rule/estimates.rb

Overview

Rule for max estimate.

Instance Method Summary collapse

Constructor Details

#initialize(xml, min) ⇒ Max

Ctor.

xml

XML with puzzles



46
47
48
49
# File 'lib/pdd/rule/estimates.rb', line 46

def initialize(xml, min)
  @xml = xml
  @min = min.to_i
end

Instance Method Details

#errorsObject



51
52
53
54
55
56
57
# File 'lib/pdd/rule/estimates.rb', line 51

def errors
  @xml.xpath("//puzzle[number(estimate) > #{@min}]").map do |p|
    "Puzzle #{p.xpath('file/text()')}:#{p.xpath('lines/text()')}"\
    " has an estimate of #{p.xpath('estimate/text()')} minutes,"\
    " which is bigger than #{@min} minutes"
  end
end