Sha256: a0c3c1c091038f849e51c4dc2c445061a7477ec21f2f22270b818fad7a52d573

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 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}: #{formatted_title}"
      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

1 entries across 1 versions & 1 rubygems

Version Path
pr_changelog-0.4.0 lib/pr_changelog/change_line.rb