entertainment_operations 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/entertainment_operations.rb +34 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7b8e480b026f72be429fdb408f08b18037b857ae
4
+ data.tar.gz: 65e63bd7fccbed66f5c0bf2511a67b2be1afad7b
5
+ SHA512:
6
+ metadata.gz: b4cde20a3fbfcf3dfd75c9a246dbaf3740a963ed573b4215aa855d8b6819500506558e30fd9372311dc72dc890fa5b1c3ce1644118ced4d513c5dd35540e497a
7
+ data.tar.gz: 1736d192886d0a7b1886194e79feaeabae4330f226bd2fedc02c9ed2ac8c58a7c7ee1fea14d5a5245884adc6243425c663e1b92d2725f12cbbdb26a0cff05de2
@@ -0,0 +1,34 @@
1
+ class EntertainmentOperations
2
+ def self.sortByRating(hashArray)
3
+ # sorts in ascending order of rating:
4
+ hashArray.sort_by! do |item|
5
+ if item[:rating].nil?
6
+ return -1
7
+ else
8
+ item[:rating]
9
+ end
10
+ end
11
+ return hashArray.reverse
12
+ end
13
+
14
+ def self.sortByTitle(hashArray)
15
+ # sorts by name alphabetically
16
+ hashArray.sort_by do |item|
17
+ if item[:name].nil?
18
+ 'zzzzzzzzzzzzzzzzzz'
19
+ else
20
+ item[:name].downcase
21
+ end
22
+ end
23
+ end
24
+
25
+ def self.getHighestRated(hashArray)
26
+ hashArray = sortByRating(hashArray)
27
+ return hashArray.first
28
+ end
29
+
30
+ def self.getLowestRated(hashArray)
31
+ hashArray = sortByRating(hashArray)
32
+ return hashArray.last
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: entertainment_operations
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nicholas Ellul
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem was originally made by Umai and Peter for me but has been rewritten
14
+ to fit new project model.
15
+ email: nicholas.ellul1@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/entertainment_operations.rb
21
+ homepage: http://rubygems.org/gems/entertainment_operations
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.6.13
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Manipulate your data
45
+ test_files: []