class WordpressChangelog

Constants

CHANGELOG
VERSION

Public Class Methods

new(mh) click to toggle source
# File lib/reapack/index/parsers.rb, line 10
def initialize(mh)
  @header = mh
end

Public Instance Methods

parse(input) click to toggle source
# File lib/reapack/index/parsers.rb, line 14
def parse(input)
  input.encode! Encoding::UTF_8, invalid: :replace

  ver, changes = @header[:version], @header[:changelog]
  return if ver.nil? || changes || CHANGELOG.match(input).nil?

  $1.lines.each {|line| read line.lstrip }
end
read(line) click to toggle source
# File lib/reapack/index/parsers.rb, line 23
def read(line)
  if line =~ VERSION
    @current = $1 == @header[:version]
  elsif @current
    if @header[:changelog]
      @header[:changelog] += "\n"
    else
      @header[:changelog] = String.new
    end

    @header[:changelog] += line.chomp
  end
end