Class: Changelog
- Inherits:
-
Object
- Object
- Changelog
- Defined in:
- lib/clemency/changelog.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #added(item) ⇒ Object
- #changed(item) ⇒ Object
- #fixed(item) ⇒ Object
-
#initialize ⇒ Changelog
constructor
A new instance of Changelog.
- #to_markdown ⇒ Object
Constructor Details
#initialize ⇒ Changelog
5 6 7 |
# File 'lib/clemency/changelog.rb', line 5 def initialize @items = Hash.new { |h, k| h[k] = [] } end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
3 4 5 |
# File 'lib/clemency/changelog.rb', line 3 def items @items end |
Instance Method Details
#added(item) ⇒ Object
13 14 15 |
# File 'lib/clemency/changelog.rb', line 13 def added(item) @items[:added] << item end |
#changed(item) ⇒ Object
17 18 19 |
# File 'lib/clemency/changelog.rb', line 17 def changed(item) @items[:changed] << item end |
#fixed(item) ⇒ Object
9 10 11 |
# File 'lib/clemency/changelog.rb', line 9 def fixed(item) @items[:fixed] << item end |
#to_markdown ⇒ Object
21 22 23 24 25 |
# File 'lib/clemency/changelog.rb', line 21 def to_markdown @items.map do |type, items| "####{type.upcase}\n" + items.map { |item| "- #{item}"}.join("\n") end.join("\n\n") end |