Permalink
Browse files

Refactor common call into private method

  • Loading branch information...
Mange committed Jan 20, 2012
1 parent 8c1fd09 commit 45dd9f225ae1ebd577cbe37b6464ee0074a6823c
Showing with 8 additions and 3 deletions.
  1. +8 −3 services/talker.rb
View
@@ -12,16 +12,21 @@ def receive_push
http.headers["X-Talker-Token"] = token
http.url_prefix = data['url']
- http_post 'messages.json', :message => "#{summary_message}#{summary_url}"
+ say "#{summary_message}#{summary_url}"
if data['digest'].to_i == 0
if distinct_commits.size == 1
commit = distinct_commits.first
- http_post 'messages.json', :message => format_commit_message(commit)
+ say format_commit_message(commit)
else
distinct_commits.each do |commit|
- http_post 'messages.json', :message => "#{format_commit_message(commit)}#{commit['url']}"
+ say "#{format_commit_message(commit)}#{commit['url']}"
end
end
end
end
+
+ private
+ def say(message)
+ http_post 'messages.json', :message => message
+ end
end

0 comments on commit 45dd9f2

Please sign in to comment.