class Renogen::ChangeLog::Model

Object to represent a Changelog/release notes

Attributes

date[RW]
items[R]
version[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/renogen/change_log/model.rb, line 10
def initialize(options={})
  @version = options[:version]
  @date = options[:date] || Date.today
  @items = []
end

Public Instance Methods

add_change(change) click to toggle source

Adds a change to the changelog

@param change [Renogen::ChangeLog::Item] @return [Array] All changes

# File lib/renogen/change_log/model.rb, line 38
def add_change(change)
  raise TypeError unless change.is_a?(Renogen::ChangeLog::Item)
  items << change
end
groups() click to toggle source

@return [Hash<group_name: change>]

# File lib/renogen/change_log/model.rb, line 17
def groups
  items.inject({}) do |hash, change|
    hash[change.group_name] ||= []
    hash[change.group_name] << change
    hash
  end
end
tickets() click to toggle source

@return [Hash<ticket id: string>]

# File lib/renogen/change_log/model.rb, line 26
def tickets
  items.inject({}) do |hash, change|
    hash[change.ticket_id] ||= {}
    hash[change.ticket_id][change.group_name] = change.to_s
    hash
  end
end