Sha256: 79393f37ff1aa1f9efa4b9416aef1274abcdd7ee3dc5e26027dbd4f511768743

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 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

5 entries across 5 versions & 1 rubygems

Version Path
pimpmychangelog-0.1.3 lib/pimpmychangelog/parser.rb
pimpmychangelog-0.1.2 lib/pimpmychangelog/parser.rb
pimpmychangelog-0.1.1 lib/pimpmychangelog/parser.rb
pimpmychangelog-0.1.0 lib/pimpmychangelog/parser.rb
pimpmychangelog-0.0.3 lib/pimpmychangelog/parser.rb