Class: Blammo::Release
- Inherits:
-
Object
- Object
- Blammo::Release
- Defined in:
- lib/blammo/release.rb
Instance Attribute Summary collapse
-
#commits ⇒ Object
readonly
Returns the value of attribute commits.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_commit(commit) ⇒ Object
- #each_commit(tag = nil, &block) ⇒ Object
-
#initialize(name, commits = []) ⇒ Release
constructor
A new instance of Release.
- #to_s ⇒ Object
- #to_yaml(options = {}) ⇒ Object
Constructor Details
#initialize(name, commits = []) ⇒ Release
Returns a new instance of Release.
5 6 7 8 |
# File 'lib/blammo/release.rb', line 5 def initialize(name, commits = []) @name = name @commits = commits end |
Instance Attribute Details
#commits ⇒ Object (readonly)
Returns the value of attribute commits.
3 4 5 |
# File 'lib/blammo/release.rb', line 3 def commits @commits end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/blammo/release.rb', line 3 def name @name end |
Instance Method Details
#add_commit(commit) ⇒ Object
10 11 12 |
# File 'lib/blammo/release.rb', line 10 def add_commit(commit) @commits << commit end |
#each_commit(tag = nil, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/blammo/release.rb', line 22 def each_commit(tag = nil, &block) if tag tag = tag.to_sym commits = @commits.select {|commit| commit.tag == tag} else commits = @commits end commits.each {|commit| block.call(commit)} end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/blammo/release.rb', line 14 def to_s @name end |
#to_yaml(options = {}) ⇒ Object
18 19 20 |
# File 'lib/blammo/release.rb', line 18 def to_yaml( = {}) {@name => @commits}.to_yaml() end |