diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-03 21:48:00 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-03 22:04:43 +0300 |
commit | 35b719f60b21fbd09a1a2b4dc0d3f1e3e74e89e1 (patch) | |
tree | 552c15d5bf7e49f5b865fb079456646577f32e8b /app/models/concerns | |
parent | 04a50bd9515e09d047d6f678c5d9485f89b31df7 (diff) |
Use delegation in ProtectedRef concern
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/protected_ref.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb index 77d7b597534..4f3500d998a 100644 --- a/app/models/concerns/protected_ref.rb +++ b/app/models/concerns/protected_ref.rb @@ -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 |