yuniversity 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2a13194d4e0fa11700fcc15435fcd23f7dafdaf
4
- data.tar.gz: 34b9d6f5222b64ec40f9977ebb894d7c4140fd17
3
+ metadata.gz: f293697b906e79aaa6fb34af2d52b8fd31658d02
4
+ data.tar.gz: ec7fd5b326a2b1ed4ffa63f5742cec6e933f708d
5
5
  SHA512:
6
- metadata.gz: f5d1e7c0fb60b005cdb9ee54a23438f73879970b45def78bdf309d774ec6bd52e352d8dbf74800b3e2fea18d4a54e36cdc3c77203356f6459f60952eefdec066
7
- data.tar.gz: 1b1f845b109ccb8d0eda33d8e92cc49f93efae8188495623a619c730fbac10ea108c86a266530562189a56414868de0f3e688a676aa780babd66fc0505d893b5
6
+ metadata.gz: 97b65220777a519fcb05fef36694957b1823f2427f98d80e84e0192f9b40d890bcfb368e1adfb63e03a962885b64b561789ba21368f130a93ef3f862479215d1
7
+ data.tar.gz: cda079264592f61059c0d834230c2b11a53cbe8f8000ef053fcf40a02a51ec0ce952476724cc22584a528a8f85b58623f5cea909c348fc15f83db217a5ca804d
data/README.md CHANGED
@@ -31,6 +31,12 @@ Or install it yourself as:
31
31
 
32
32
  YUniversity::RAW - for raw data
33
33
 
34
+ YUniversity.find_by_country('philippines') - this will return all the schools from philippines.
35
+
36
+ YUniversity.find_by_countries(['philippines', 'japan', 'korea']) - this will return all the schools from japan and korea
37
+
38
+ YUniversity.find_country_by_university('New York University Tirana') - this will return the country for New York University Tirana
39
+
34
40
  ## Contributing
35
41
 
36
42
  1. Fork it
data/lib/yuniversity.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "yuniversity/version"
2
2
  require 'yaml'
3
-
3
+ require 'pry'
4
4
  module YUniversity
5
5
  RAW = YAML.load_file(File.join(File.dirname(__FILE__), 'YUniversity', 'data', 'universities.yml'))
6
6
 
@@ -12,7 +12,16 @@ module YUniversity
12
12
 
13
13
  NAMES = ALL.map{|u| u['name']}
14
14
 
15
- def self.by_country(country)
15
+ def self.find_by_country(country)
16
16
  ALL.select{|c| c['country'].downcase.match(country.downcase)}
17
17
  end
18
+
19
+ def self.find_by_countries(countries)
20
+ ALL.select{|c| countries.map{|e| e.downcase }.include?(c['country'].downcase)}
21
+ end
22
+
23
+ def self.find_country_by_university(university)
24
+ university = ALL.find{|c| c['name'].downcase.match(university.downcase)}
25
+ university['country'] unless university.nil?
26
+ end
18
27
  end
@@ -1,3 +1,3 @@
1
1
  module YUniversity
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yuniversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rewin0087
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler