Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-11-19 08:35:03 +0300
committerStan Hu <stanhu@gmail.com>2016-11-22 03:47:29 +0300
commit4d7303a98e970c29079cc03a449c71f3cdaa1214 (patch)
tree4b40180e5c58ded66ade1e9f6d363dc409fe0017 /lib/bitbucket
parent9e6b25d0bc5c2f88330bb074db242017ea45f90d (diff)
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)