mumukit-auth 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/auth/slug.rb +16 -1
- data/lib/mumukit/auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 822a6899489c66e29fcf58843040f7db681eb322
|
4
|
+
data.tar.gz: 2b8d6099424c7d62797275bf01f425b888907901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 089dfa0aa8114c662c792b1e376f365a46a8a9a00c141c98db30ea76732335dffb05926f0e0b6a347fd4b9926577aa902285c5b7c763e247250e1b0a69e5a5fc
|
7
|
+
data.tar.gz: 3b7312806588e1e707099c6f090ef4e02aa3b520b91547e84b4a2bdd06f4904219be5c4251956ab6f649980e4fc5c4f2899785b5e5e9e2e95c40e364c98ff85c
|
data/lib/mumukit/auth/slug.rb
CHANGED
@@ -39,9 +39,24 @@ module Mumukit::Auth
|
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.from_options(hash)
|
43
|
+
first = hash[:first] || hash[:organization]
|
44
|
+
second = hash[:second] || hash[:repository] || hash[:course] || hash[:content]
|
45
|
+
new(first, second)
|
46
|
+
end
|
47
|
+
|
42
48
|
def self.join(*parts)
|
43
49
|
raise 'Slugs must have up to two parts' if parts.length > 2
|
44
|
-
|
50
|
+
|
51
|
+
if parts.first.is_a? Hash
|
52
|
+
from_options parts.first
|
53
|
+
else
|
54
|
+
new(*parts.pad_with('_', 2))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.join_s(*args)
|
59
|
+
join(*args).to_s
|
45
60
|
end
|
46
61
|
|
47
62
|
def self.parse(slug)
|
data/lib/mumukit/auth/version.rb
CHANGED