class ErrataParser attr_reader :item def initialize src @item = Hash.new @src = src @pos = 0 target = /\n|\n|\n<target>|\n<url>|\n<info>|\n<directory>|\n<update>/ while @pos != @src.length from = @pos to = @src.index target, from if to == nil @pos = @src.length if @src[from..@src.length].match /^<([^\s]+)>\n(.*)/m @item[$1.downcase] = $2.rstrip end else @pos = to + 1 if @src[from..to].match /^<([^\s]+)>\n(.*)/m @item[$1.downcase] = $2.rstrip end end end end end