class Twigg::Commit
Attributes
body[R]
commit[R]
date[R]
repo[R]
stat[R]
subject[R]
Public Class Methods
new(options)
click to toggle source
# File lib/twigg/commit.rb, line 5 def initialize(options) raise ArgumentError unless @repo = options[:repo] raise ArgumentError unless @commit = options[:commit] raise ArgumentError unless @subject = options[:subject] raise ArgumentError unless @body = options[:body] raise ArgumentError unless @author = options[:author] raise ArgumentError unless @date = options[:date] raise ArgumentError unless @stat = options[:stat] end
Public Instance Methods
eql?(other)
click to toggle source
# File lib/twigg/commit.rb, line 25 def eql?(other) other.is_a?(Commit) && other.repo == @repo && other.commit == @commit && other.subject == @subject && other.body == @body && other.author == @author && other.date == @date && other.stat == @stat end
filtered_commit_message()
click to toggle source
# File lib/twigg/commit.rb, line 36 def filtered_commit_message @filtered_commit_message ||= @body.reject do |line| line =~ /^[a-z-]+: /i # filter out Change-Id:, Signed-off-by: etc end.concat([@subject]).join("\n").chomp end
flesch_reading_ease()
click to toggle source
# File lib/twigg/commit.rb, line 42 def flesch_reading_ease @flesch_reading_ease ||= Flesch.new(filtered_commit_message).reading_ease end
inspect()
click to toggle source
# File lib/twigg/commit.rb, line 51 def inspect "repo: #{@repo.name}\n" + "commit: #{@commit}\n" + "subject: #{@subject}\n" + "author: #{@author}\n" + "stat: +#{@stat[:additions]}, -#{@stat[:deletions]}" end
link()
click to toggle source
# File lib/twigg/commit.rb, line 15 def link if Config.github.organization "https://github.com/#{Config.github.organization}/#{repo.name}/commit/#{commit}" end end
russianness()
click to toggle source
Return the length of the commit message in lines.
# File lib/twigg/commit.rb, line 47 def russianness filtered_commit_message.lines.count end