Class: Blammo::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/blammo/release.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commitsObject (readonly)

Returns the value of attribute commits.



3
4
5
# File 'lib/blammo/release.rb', line 3

def commits
  @commits
end

#nameObject (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_sObject



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(options = {})
  {@name => @commits}.to_yaml(options)
end