glib 0.0.1 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/glib.rb +21 -28
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74ecc356512048a97b7fd12177d0e07d79be59db
4
- data.tar.gz: 0c7c72afae36cbd76a59491d5472cec5ba0239dc
3
+ metadata.gz: bcd6759a271330da95bd800cdc140c19b056a003
4
+ data.tar.gz: 7479736d2820df06aabcae38076cbc1ae44e18f1
5
5
  SHA512:
6
- metadata.gz: e097da0e98780aa4bc179871fad01b8619e323d2d445b10e190befbfc2ba426c53017165167b27f23004f4646d9f0acd167cd455b7d16979e589ad391253d4e9
7
- data.tar.gz: 0a9107da764ea49c562e732db14253226e96ec7daca18db32ae303aa91e3c199aba59993d9562b64518d6f9564219c969745de65d27a6804aa4ae5faeb9753e3
6
+ metadata.gz: a595ff40fe1c88411cde763fc01dc8645b8e00dba584ff27fafa8f704e995bff26d85b722ec02988a836516b126f709e568f345ab5639dd60ef6d4bca8c5eb35
7
+ data.tar.gz: 1691289edfa4450666a649dbb9780ebb6f9778e145d59e4c054647ea6d600414c07db927b4c0d761d5ad76f16ca4de2eb0a7250a8b7cd899f17a7f97f23e6dc6
data/lib/glib.rb CHANGED
@@ -1,54 +1,47 @@
1
- # Glib.rb
2
- # Gabriel Vian
3
-
4
1
  module Glib
5
- def Glib.shift(array, index)
2
+ def self.shift(array, index)
6
3
  if not array.kind_of?(Array) then raise TypeError, "expected: Array" end
7
4
  array.delete_at(index)
8
5
  newarray = []
9
6
  for i in 0..array.length - 1
10
- if not array[i] == nil
11
- newarray.push(array[i])
7
+ if array[i] != nil
8
+ newarray.push(array[i])
9
+ end
12
10
  end
13
- end
14
11
  return newarray
15
12
  end
16
- def Glib.isnum?(input)
17
- if input.class != "String" then raise TypeError, "expected: String or Integer" end
18
- alltrue = input.length
19
- for i in 0..input.length - 1
20
- if input[i].ord <= 57 and input[i].ord >= 48
21
- alltrue -= 1
22
- end
23
- end
24
- if alltrue == 0
25
- return true
26
- else
27
- return false
28
- end
29
- end
30
- def Glib.isodd?(input)
13
+ def self.isodd?(input)
31
14
  if input % 2 != 0
32
15
  return true
33
16
  else
34
17
  return false
35
18
  end
36
19
  end
37
- def Glib.iseven?(input)
20
+ def self.iseven?(input)
38
21
  if input % 2 == 0
39
22
  return true
40
23
  else
41
24
  return false
42
25
  end
43
26
  end
44
- def Glib.greatest(array)
27
+ def self.greatest(array)
45
28
  if not array.kind_of?(Array) then raise TypeError, "expected: Array" end
46
- greatest = 0
29
+ greatest_index = 0
47
30
  for i in 0..array.length - 1
48
- if array[i] > array[greatest]
49
- greatest = i
31
+ if array[i] > array[greatest_index]
32
+ greatest_index = i
33
+ end
34
+ end
35
+ return greatest_index
36
+ end
37
+ def self.smallest(array)
38
+ if not array.kind_of?(Array) then raise TypeError, "expected: Array" end
39
+ smallest_index = 0
40
+ for i in 1..array.length - 1
41
+ if array[i] < array[smallest_index]
42
+ smallest_index = i
50
43
  end
51
44
  end
52
- return greatest
45
+ return smallest_index
53
46
  end
54
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Vian
@@ -37,8 +37,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubyforge_project:
40
- rubygems_version: 2.6.13
40
+ rubygems_version: 2.6.11
41
41
  signing_key:
42
42
  specification_version: 4
43
- summary: Test gem
43
+ summary: Completely useless
44
44
  test_files: []