Sha256: 508e8746836f565bf1e1891d54e4bb25c48d6039b8afec79caba1fb89ba62901

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

module PrLog
  # Get mentioned issues from a changelog
  class ParsedChangelog
    def initialize(text, options = {})
      @text = text
      @github_repository = options.fetch(:github_repository)
    end

    def mentioned_issue_numbers
      @text.scan(pull_request_urls_matcher).flatten.map(&:to_i)
    end

    private

    def pull_request_urls_matcher
      %r{#{repository_url_matcher}/pull/(\d+)}
    end

    def repository_url_matcher
      %r{https?://github.com/#{@github_repository}}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pr_log-0.3.0 lib/pr_log/parsed_changelog.rb
pr_log-0.2.0 lib/pr_log/parsed_changelog.rb
pr_log-0.1.0 lib/pr_log/parsed_changelog.rb