rubyul 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubyul.rb +9 -9
- data/lib/rubyul/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: 796ed1cea3ca42c4048e9fd0352636f45c6f0699
|
4
|
+
data.tar.gz: 4a7a844e9e05a0fe632c5e13f5b3ee0f7bb36158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43fd90eae49fc30eb51e62658432f948654ee0586f3aa40860f4c3ceaeb4c4cede4291cb7964d3825ed18ab0854189e14cb13ae66091522d46047496d74968bc
|
7
|
+
data.tar.gz: 29d68789ae8c6704166a6b1142ad55513b07ba74d23ef8bce79fbdaeac60f0413c06c605ab783b6b240e40d711cbad4f31cdc784c6d7525b834672497d4ecccc
|
data/lib/rubyul.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require "rubyul/version"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "date"
|
4
|
+
require "json"
|
5
5
|
|
6
|
+
# All the small helper functions are here.
|
6
7
|
module Rubyul
|
7
|
-
|
8
8
|
def self.academic_year(date)
|
9
|
+
# Academic years go from September to August.
|
9
10
|
(Date.parse(date) << 8).year
|
10
11
|
end
|
11
12
|
|
12
|
-
PLATFORM_REGEXES = JSON.parse(File.read(File.dirname(__FILE__) +
|
13
|
+
PLATFORM_REGEXES = JSON.parse(File.read(File.dirname(__FILE__) +
|
14
|
+
"/platform_regexes.json"))
|
13
15
|
|
14
16
|
def self.hostname_to_platform(hostname)
|
17
|
+
# TODO: Deal with ignores or not, with an option.
|
15
18
|
PLATFORM_REGEXES.each do |regexp, platform_name|
|
16
|
-
if Regexp.new(regexp) =~ hostname
|
17
|
-
return platform_name
|
18
|
-
end
|
19
|
+
return platform_name if Regexp.new(regexp) =~ hostname
|
19
20
|
end
|
20
|
-
|
21
|
+
nil
|
21
22
|
end
|
22
|
-
|
23
23
|
end
|
data/lib/rubyul/version.rb
CHANGED