Use delegation in ProtectedRef concern
This commit is contained in:
parent
04a50bd951
commit
35b719f60b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue