Class: Gitlab::Release::Changelog::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/release/changelog/entry.rb

Overview

This class represents a single changelog element.

Direct Known Subclasses

Issue, MergeRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, title) ⇒ Entry

Returns a new instance of Entry.

Parameters:

  • id (Integer)
  • title (String)


12
13
14
15
# File 'lib/gitlab/release/changelog/entry.rb', line 12

def initialize(id, title)
  @id = id
  @title = title
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/gitlab/release/changelog/entry.rb', line 8

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/gitlab/release/changelog/entry.rb', line 8

def title
  @title
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/gitlab/release/changelog/entry.rb', line 17

def to_s
  "Changelog::Entry { id: #{id}, title: '#{title}' }"
end

#to_s_for_changelog(with_reference) ⇒ String

Print this entry with or without reference.

Parameters:

  • with_reference (Boolean)

    Required. Generate the changelog with MRs and Issues reference.

Returns:

  • (String)


27
28
29
# File 'lib/gitlab/release/changelog/entry.rb', line 27

def to_s_for_changelog(with_reference)
  "- #{title}"
end