Class: Gitlab::Release::Changelog::Entries
- Inherits:
-
Object
- Object
- Gitlab::Release::Changelog::Entries
- Defined in:
- lib/gitlab/release/changelog/entries.rb
Overview
This class is a collection wrapper of changelog items, useful to generate easily changelog as String.
Instance Method Summary collapse
-
#initialize ⇒ Entries
constructor
A new instance of Entries.
-
#push(element) ⇒ Object
Add a new Entry element.
-
#to_s ⇒ String
Print the changelog without any reference.
-
#to_s_with_reference ⇒ String
Print the changelog with relative reference.
-
#write_in_file(path, appending = false, with_reference = true) ⇒ Object
Write the changelog content as String in a file.
Constructor Details
#initialize ⇒ Entries
Returns a new instance of Entries
8 9 10 11 |
# File 'lib/gitlab/release/changelog/entries.rb', line 8 def initialize # @type [Array] elements @elements = [] end |
Instance Method Details
#push(element) ⇒ Object
Add a new Entry element.
18 19 20 |
# File 'lib/gitlab/release/changelog/entries.rb', line 18 def push(element) @elements.push(element) end |
#to_s ⇒ String
Print the changelog without any reference.
27 28 29 |
# File 'lib/gitlab/release/changelog/entries.rb', line 27 def to_s internal_to_s_with_reference(false) end |
#to_s_with_reference ⇒ String
Print the changelog with relative reference.
36 37 38 |
# File 'lib/gitlab/release/changelog/entries.rb', line 36 def to_s_with_reference internal_to_s_with_reference(true) end |
#write_in_file(path, appending = false, with_reference = true) ⇒ Object
Write the changelog content as String in a file.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gitlab/release/changelog/entries.rb', line 47 def write_in_file(path, appending = false, with_reference = true) # @type [String] changelog_string changelog_string = internal_to_s_with_reference(with_reference) searched_paths = Dir.glob(path) if !searched_paths.empty? searched_paths.each do |single_path| internal_write_on_file(single_path, changelog_string, appending) end else internal_write_on_file(path, changelog_string, appending) end end |