Class: Changelog

Inherits:
Object
  • Object
show all
Defined in:
lib/clemency/changelog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChangelog



5
6
7
# File 'lib/clemency/changelog.rb', line 5

def initialize
  @items = Hash.new { |h, k| h[k] = [] }
end

Instance Attribute Details

#itemsObject (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_markdownObject



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