Sha256: cb3210241da12140b90b85dc814be114525b3d7a9ced5505e03c8622310b8ed5

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module PrChangelog
  # Represents a single change entry in the changelog
  class ChangeLine
    attr_reader :pr_number, :tag, :title

    def initialize(pr_number, tag, title)
      @pr_number = pr_number
      @tag = tag
      @title = title
    end

    def to_s
      if tag.nil?
        "- #{pr_number}: #{title.first_lowercase}"
      else
        "- #{pr_number}: #{tag}: #{title.first_lowercase}"
      end
    end

    def formatted_title
      title.first_uppercase
    end

    def emojified_for(tag_object)
      "- #{pr_number}: #{tag_object.emoji} #{formatted_title}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pr_changelog-0.3.0 lib/pr_changelog/change_line.rb
pr_changelog-0.2.0 lib/pr_changelog/change_line.rb
pr_changelog-0.1.1 lib/pr_changelog/change_line.rb