class VCLog::Release
A Release
encapsulate a collection of {Change} objects associated with a {Tag}.
Attributes
changes[R]
Array of Change
objects.
tag[R]
Tag
object this release represents.
Public Class Methods
new(tag, changes)
click to toggle source
New Release
object.
@param [Tag] tag
A Tag object.
@param [Array<Change>] changes
An array of Change objects.
# File lib/vclog/release.rb, line 23 def initialize(tag, changes) @tag = tag @changes = changes end
Public Instance Methods
<=>(other)
click to toggle source
Compare release by tag.
@param [Release] other
Another release instance.
# File lib/vclog/release.rb, line 46 def <=>(other) @tag <=> other.tag end
groups()
click to toggle source
Group changes
by type and sort by level.
@return [Array<Array>]
Returns an associative array of [type, changes].
# File lib/vclog/release.rb, line 34 def groups @groups ||= ( changes.group_by{ |e| e.label }.sort{ |a,b| b[1][0].level <=> a[1][0].level } ) end
to_h()
click to toggle source
Convert Release
to Hash.
@todo Should version
be name
?
# File lib/vclog/release.rb, line 55 def to_h { 'version' => tag.name, 'date' => tag.date, 'message' => tag.message, 'author' => tag.author, 'id' => tag.id, 'changes' => changes.map{|change| change.to_h} } end