mumukit-core 0.6.0 → 1.0.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/core/request.rb +11 -11
- data/lib/mumukit/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37c1a7df3904ad04532d27dabcf82d24d55d6b04
|
4
|
+
data.tar.gz: 6dc1c171303662458b7f22cf6e1d91b91cd98676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4bbb152e184016120e14569f268a91276d73492482aea937bc962e5b03d9900496647e3bd8148cc8c0d761d423aa0c27c7abb4b8b9ee33cf41b314cd901af5c
|
7
|
+
data.tar.gz: 8a6609ba61a584d1ff8f21732296a45208502aaba697b80fc1b050e13a18c5285a7e9c5d50a31cff54eee429e03f2b56f0fe0b787262b9682ee75d6a993ba403
|
data/lib/mumukit/core/request.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
+
require 'rack'
|
1
2
|
require 'rack/request'
|
2
3
|
|
3
4
|
module Rack
|
4
5
|
class Request
|
5
|
-
def
|
6
|
-
|
6
|
+
def first_subdomain_after(domain)
|
7
|
+
subdomain_after(domain)&.first
|
7
8
|
end
|
8
9
|
|
9
|
-
def
|
10
|
-
first_subdomain || 'central'
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def extract_subdomains
|
10
|
+
def subdomain_after(domain)
|
16
11
|
raise 'no host set' unless host
|
17
12
|
raise 'set hostname first!' if /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host)
|
18
13
|
return nil if host == 'localhost'
|
19
|
-
|
14
|
+
domain_parts = domain.split('.')
|
15
|
+
(host.split('.') - domain_parts)
|
16
|
+
end
|
17
|
+
|
18
|
+
def empty_subdomain_after?(domain)
|
19
|
+
first_subdomain_after(domain).blank?
|
20
20
|
end
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/lib/mumukit/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|