unm 0.0.4 → 0.0.5
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/unm/version.rb +1 -1
- data/lib/unm.rb +17 -2
- metadata +3 -3
- data/unm-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0200adb0654696f17eecccc317cde4b1f9334196
|
4
|
+
data.tar.gz: 738532753f27e20c704d36cdbabcb59eeb4ba0b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29995e61c19973b195dc97dfff0755c8758388685c9b994716585f08378db99189373527ae56c98834e9425d69796df36848baa3393e71ae4788d3ebf332d1c4
|
7
|
+
data.tar.gz: c749fc0891d66abbe617683c684fc6c59a961fb8d993b12b1c304a3bf67443045133e22cbf08a628e828c640a743d39d44aa290341c17d5868a47119ee7dee90
|
data/lib/unm/version.rb
CHANGED
data/lib/unm.rb
CHANGED
@@ -53,12 +53,27 @@ module Unm
|
|
53
53
|
name = subject["subjectName"]
|
54
54
|
{ name => [courses].flatten.map do |course|
|
55
55
|
course_name = name + " " + course["name"]
|
56
|
-
|
57
|
-
|
56
|
+
course_page = Nokogiri::HTML.parse(HTTParty.get(URI.escape course["path"])) rescue course["path"]
|
57
|
+
description = course_page.css('.content > p').first.text rescue "Error loading description. Check #{course["path"]}."
|
58
|
+
prerequisites = find_prerequisites(course_page) rescue "Error loading prerequisites. Check #{course["path"]}."
|
59
|
+
{ "name" => course_name, "description" => description, "prerequisites" => prerequisites }
|
58
60
|
end }
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
64
|
+
def self.find_prerequisites(site)
|
65
|
+
start = site.css("hr").first
|
66
|
+
finish = site.css("hr")[1]
|
67
|
+
prerequisites = []
|
68
|
+
until start == finish
|
69
|
+
prerequisites << start.text.split("- ").last if start.css('a').any?
|
70
|
+
start = start.next_element
|
71
|
+
end
|
72
|
+
prerequisites
|
73
|
+
end
|
74
|
+
|
75
|
+
private_class_method :find_prerequisites
|
76
|
+
|
62
77
|
end
|
63
78
|
|
64
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Piro-Rael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,6 @@ files:
|
|
80
80
|
- Rakefile
|
81
81
|
- lib/unm.rb
|
82
82
|
- lib/unm/version.rb
|
83
|
-
- unm-0.0.2.gem
|
84
83
|
- unm.gemspec
|
85
84
|
homepage: ''
|
86
85
|
licenses:
|
@@ -107,3 +106,4 @@ signing_key:
|
|
107
106
|
specification_version: 4
|
108
107
|
summary: Utilities to interact with UNM Interfaces.
|
109
108
|
test_files: []
|
109
|
+
has_rdoc:
|
data/unm-0.0.2.gem
DELETED
Binary file
|