summaryrefslogtreecommitdiff
path: root/lib/flowdock/git/builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/flowdock/git/builder.rb')
-rw-r--r--lib/flowdock/git/builder.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/flowdock/git/builder.rb b/lib/flowdock/git/builder.rb
index 6f4428d1f42..46513e19fd4 100644
--- a/lib/flowdock/git/builder.rb
+++ b/lib/flowdock/git/builder.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Flowdock
class Git
class Commit
@@ -15,11 +16,11 @@ module Flowdock
event: "activity",
author: {
name: @commit[:author][:name],
- email: @commit[:author][:email]
+ email: @commit[:author][:email],
},
title: title,
thread: @thread,
- body: body
+ body: body,
}
hash[:tags] = @tags if @tags
encode(hash)
@@ -52,7 +53,7 @@ module Flowdock
def body
content = @commit[:message][first_line.size..-1]
- content.strip! if content
+ content&.strip!
"<pre>#{content}</pre>" unless content.empty?
end
@@ -94,14 +95,14 @@ module Flowdock
message: commit.message,
author: {
name: commit.author_name,
- email: commit.author_email
- }
+ email: commit.author_email,
+ },
}
end
end
def ref_name
- @ref.to_s.sub(%r{\Arefs/(heads|tags)/}, '')
+ @ref.to_s.sub(%r{\Arefs/(heads|tags)/}, "")
end
def to_hashes
@@ -115,7 +116,7 @@ module Flowdock
def thread
@thread ||= {
title: thread_title,
- external_url: @opts[:repo_url]
+ external_url: @opts[:repo_url],
}
end
@@ -127,7 +128,7 @@ module Flowdock
def thread_title
action = "updated" if permanent?
- type = @ref =~ %r(^refs/heads/) ? "branch" : "tag"
+ type = %r{^refs/heads/}.match?(@ref) ? "branch" : "tag"
[@opts[:repo_name], type, ref_name, action].compact.join(" ")
end