module Redpen class Result ERROR_REGEXP = /ValidationError/ MESSAGE_REDEXP = /\A\[[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+\.[0-9]+\].*\Z/ attr_reader :messages def initialize(raw_message) @messages = raw_message.split("\n").reject { |msg| msg.match(MESSAGE_REDEXP) } end def valid? messages.all? { |msg| msg !~ ERROR_REGEXP } end end end