Use delegation in ProtectedRef concern

This commit is contained in:
James Edwards-Jones 2017-04-03 19:48:00 +01:00
parent 04a50bd951
commit 35b719f60b
1 changed files with 2 additions and 12 deletions

View File

@ -6,6 +6,8 @@ module ProtectedRef
validates :name, presence: true
validates :project, presence: true
delegate :matching, :matches?, :wildcard?, to: :ref_matcher
def self.matching_refs_accesible_to(ref, user, action: :push)
access_levels_for_ref(ref, action).any? do |access_level|
access_level.check_access(user)
@ -27,18 +29,6 @@ module ProtectedRef
project.commit(self.name)
end
def matching(refs)
ref_matcher.matching(refs)
end
def matches?(refs)
ref_matcher.matches?(refs)
end
def wildcard?
ref_matcher.wildcard?
end
private
def ref_matcher