glib 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/glib.rb +54 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 74ecc356512048a97b7fd12177d0e07d79be59db
|
4
|
+
data.tar.gz: 0c7c72afae36cbd76a59491d5472cec5ba0239dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e097da0e98780aa4bc179871fad01b8619e323d2d445b10e190befbfc2ba426c53017165167b27f23004f4646d9f0acd167cd455b7d16979e589ad391253d4e9
|
7
|
+
data.tar.gz: 0a9107da764ea49c562e732db14253226e96ec7daca18db32ae303aa91e3c199aba59993d9562b64518d6f9564219c969745de65d27a6804aa4ae5faeb9753e3
|
data/lib/glib.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Glib.rb
|
2
|
+
# Gabriel Vian
|
3
|
+
|
4
|
+
module Glib
|
5
|
+
def Glib.shift(array, index)
|
6
|
+
if not array.kind_of?(Array) then raise TypeError, "expected: Array" end
|
7
|
+
array.delete_at(index)
|
8
|
+
newarray = []
|
9
|
+
for i in 0..array.length - 1
|
10
|
+
if not array[i] == nil
|
11
|
+
newarray.push(array[i])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
return newarray
|
15
|
+
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)
|
31
|
+
if input % 2 != 0
|
32
|
+
return true
|
33
|
+
else
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
def Glib.iseven?(input)
|
38
|
+
if input % 2 == 0
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
def Glib.greatest(array)
|
45
|
+
if not array.kind_of?(Array) then raise TypeError, "expected: Array" end
|
46
|
+
greatest = 0
|
47
|
+
for i in 0..array.length - 1
|
48
|
+
if array[i] > array[greatest]
|
49
|
+
greatest = i
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return greatest
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glib
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabriel Vian
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Testing gem
|
14
|
+
email: casa@gabrielvian.it
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/glib.rb
|
20
|
+
homepage: http://rubygems.org/gems/glib
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.6.13
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Test gem
|
44
|
+
test_files: []
|