Class: VCLog::Release
- Inherits:
-
Object
- Object
- VCLog::Release
- Defined in:
- lib/vclog/release.rb
Overview
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Array of Change objects.
-
#tag ⇒ Object
readonly
Tag object this release represents.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Compare release by tag.
-
#groups ⇒ Array<Array>
Group
changes
by type and sort by level. -
#initialize(tag, changes) ⇒ Release
constructor
New Release object.
-
#to_h ⇒ Object
Convert Release to Hash.
Constructor Details
#initialize(tag, changes) ⇒ Release
New Release object.
23 24 25 26 |
# File 'lib/vclog/release.rb', line 23 def initialize(tag, changes) @tag = tag @changes = changes end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Array of Change objects.
12 13 14 |
# File 'lib/vclog/release.rb', line 12 def changes @changes end |
#tag ⇒ Object (readonly)
Tag object this release represents.
9 10 11 |
# File 'lib/vclog/release.rb', line 9 def tag @tag end |
Instance Method Details
#<=>(other) ⇒ Object
Compare release by tag.
46 47 48 |
# File 'lib/vclog/release.rb', line 46 def <=>(other) @tag <=> other.tag end |
#groups ⇒ Array<Array>
Group changes
by type and sort by level.
34 35 36 37 38 |
# 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 ⇒ Object
TODO:
Should version
be name
?
Convert Release to Hash.
55 56 57 58 59 60 61 62 63 |
# File 'lib/vclog/release.rb', line 55 def to_h { 'version' => tag.name, 'date' => tag.date, 'message' => tag., 'author' => tag., 'id' => tag.id, 'changes' => changes.map{|change| change.to_h} } end |