Describe for Roles

This commit is contained in:
Dmitriy Zaporozhets 2012-12-30 16:19:31 +02:00
parent 64db5f808b
commit 82ae973a99
11 changed files with 75 additions and 3 deletions

View file

@ -1,3 +1,9 @@
# == PushEvent role
#
# Extends Event model functionality by providing extra methods related to push events
#
# Used by Event
#
module PushEvent
def valid_push?
data[:ref]
@ -58,7 +64,7 @@ module PushEvent
@commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
end
def commits_count
def commits_count
data[:total_commits_count] || commits.count || 0
end
@ -88,7 +94,7 @@ module PushEvent
nil
end
def push_with_commits?
def push_with_commits?
md_ref? && commits.any? && parent_commit && last_commit
rescue Grit::NoSuchPathError
false