Class: GFSM::Data::Commit

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/data/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit, trailer_key, category) ⇒ Commit

Returns a new instance of Commit.



12
13
14
15
16
17
# File 'lib/data/commit.rb', line 12

def initialize(commit, trailer_key, category)
  @commit = commit
  @trailer_key = trailer_key
  @category = category
  @subject = commit.message.lines.first.chomp
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



10
11
12
# File 'lib/data/commit.rb', line 10

def category
  @category
end

#subjectObject (readonly)

Returns the value of attribute subject.



10
11
12
# File 'lib/data/commit.rb', line 10

def subject
  @subject
end

#trailer_keyObject (readonly)

Returns the value of attribute trailer_key.



10
11
12
# File 'lib/data/commit.rb', line 10

def trailer_key
  @trailer_key
end

Instance Method Details

#short_sha(length = 7) ⇒ Object



19
20
21
# File 'lib/data/commit.rb', line 19

def short_sha(length = 7)
  self.sha[0, length]
end

#to_changelog_entryObject



23
24
25
# File 'lib/data/commit.rb', line 23

def to_changelog_entry
  "#{subject} (#{short_sha})"
end