Sha256: 3401b499cd1627a31d03cc5d5dff82c2f40810cc7cc156affeae5f069c750300

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

module PimpMyChangelog
  class Parser
    attr_reader :changelog

    # @param [String] changelog
    def initialize(changelog)
      @changelog = changelog
    end

    # @return [String] the changelog content without the link definitions
    def content
      @changelog.split(Pimper::SEPARATOR).first
    end

    # @return [Array] ordered array of issue numbers found in the changelog
    #   Example: ['12', '223', '470']
    def issues
      changelog.scan(/#(\d+)/).flatten.uniq.sort_by(&:to_i)
    end

    # @return [Array] ordered array of contributors found in the changelog
    #   Example: ['gregbell', 'pcreux', 'samvincent']
    def contributors
      changelog.scan(/@(\w+)/).flatten.uniq.sort
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pimpmychangelog-0.0.2 lib/pimpmychangelog/parser.rb
pimpmychangelog-0.0.1 lib/pimpmychangelog/parser.rb