lib/pdd.rb in pdd-0.10 vs lib/pdd.rb in pdd-0.11

- old
+ new

@@ -24,10 +24,11 @@ require 'pdd/sources' require 'pdd/version' require 'pdd/rule/estimates' require 'pdd/rule/text' require 'pdd/rule/duplicates' +require 'pdd/rule/roles' require 'nokogiri' require 'logger' require 'time' # PDD main module. @@ -45,11 +46,12 @@ RULES = { 'min-estimate' => PDD::Rule::Estimate::Min, 'max-estimate' => PDD::Rule::Estimate::Max, 'min-words' => PDD::Rule::Text::MinWords, - 'max-duplicates' => PDD::Rule::MaxDuplicates + 'max-duplicates' => PDD::Rule::MaxDuplicates, + 'available-roles' => PDD::Rule::Roles::Available } # Get logger. def self.log unless @logger @@ -137,10 +139,10 @@ total = 0 (@opts[:rule] || []).push('max-duplicates:1').map do |r| name, value = r.split(':') rule = RULES[name] fail "rule '#{name}' doesn't exist" if rule.nil? - rule.new(doc, value.to_i).errors.each do |e| + rule.new(doc, value).errors.each do |e| PDD.log.error e total += 1 end end fail PDD::Error, "#{total} errors, see log above" unless total == 0