summaryrefslogtreecommitdiff
path: root/lib/bitbucket
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-11-18 21:35:03 -0800
committerStan Hu <stanhu@gmail.com>2016-11-21 16:47:29 -0800
commit4d7303a98e970c29079cc03a449c71f3cdaa1214 (patch)
tree4b40180e5c58ded66ade1e9f6d363dc409fe0017 /lib/bitbucket
parent9e6b25d0bc5c2f88330bb074db242017ea45f90d (diff)
downloadgitlab-ce-4d7303a98e970c29079cc03a449c71f3cdaa1214.tar.gz
Clean up owner and slug representation
Diffstat (limited to 'lib/bitbucket')
-rw-r--r--lib/bitbucket/representation/repo.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/bitbucket/representation/repo.rb b/lib/bitbucket/representation/repo.rb
index fe5cda66ab9..b291dfe0441 100644
--- a/lib/bitbucket/representation/repo.rb
+++ b/lib/bitbucket/representation/repo.rb
@@ -5,10 +5,18 @@ module Bitbucket
def initialize(raw)
super(raw)
+ end
- if full_name && full_name.split('/').size == 2
- @owner, @slug = full_name.split('/')
- end
+ def owner_and_slug
+ @owner_and_slug ||= full_name.split('/', 2)
+ end
+
+ def owner
+ owner_and_slug.first
+ end
+
+ def slug
+ owner_and_slug.last
end
def clone_url(token = nil)