glib 0.0.6 → 0.0.7
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/glib-array.rb +59 -0
- data/lib/glib.rb +0 -60
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff540d005751a6deb53d2ca49c914704c9f7a9bf
|
4
|
+
data.tar.gz: 393de213f32ee042756a8ceeb32b8d4c9cbff120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be19a98ce6b7437452e5a16f1f1d4858dc196cf058ebd81eb2433cdfc4b5755cf2c1f3f32681232f45ecb8c99e668aa64457edaf5965fb2a653c73c1720a015c
|
7
|
+
data.tar.gz: 21789dede14cda6473bceda2ef8f3ae39e94cf879c75b8e6457a1decd4ca67bd897956b51aa6281778a96cbb602fa774bc5e30c2cf1687a02a2c48cc8591987a
|
data/lib/glib-array.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
class Array
|
2
|
+
def tableprint()
|
3
|
+
long = 0
|
4
|
+
for i in 0..self.length - 1
|
5
|
+
for j in 0..self[i].length - 1
|
6
|
+
if self[i][j].to_s.length > long
|
7
|
+
long = self[i][j].to_s.length
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
for i in 0..self.length - 1
|
13
|
+
for j in 0..self[i].length - 1
|
14
|
+
spaces = " "
|
15
|
+
for k in 1..long - self[i][j].to_s.length
|
16
|
+
spaces = spaces + " "
|
17
|
+
end
|
18
|
+
print self[i][j].to_s + spaces
|
19
|
+
end
|
20
|
+
puts ""
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def normalize(char = ",")
|
25
|
+
concat = ""
|
26
|
+
for i in 0..self.length - 1
|
27
|
+
concat = concat + self[i] + char
|
28
|
+
end
|
29
|
+
return concat[0..-2]
|
30
|
+
end
|
31
|
+
|
32
|
+
def smallest()
|
33
|
+
smallest_index = 0
|
34
|
+
for i in 1..self.length - 1
|
35
|
+
if self[i] < self[smallest_index]
|
36
|
+
smallest_index = i
|
37
|
+
end
|
38
|
+
end
|
39
|
+
return smallest_index
|
40
|
+
end
|
41
|
+
|
42
|
+
def greatest()
|
43
|
+
greatest_index = 0
|
44
|
+
for i in 0..self.length - 1
|
45
|
+
if self[i] > self[greatest_index]
|
46
|
+
greatest_index = i
|
47
|
+
end
|
48
|
+
end
|
49
|
+
return greatest_index
|
50
|
+
end
|
51
|
+
|
52
|
+
def uniform()
|
53
|
+
tot = self.length - 1
|
54
|
+
for i in 1..self.length - 1
|
55
|
+
if self[i] == self[0] then tot-=1 end
|
56
|
+
end
|
57
|
+
return tot == 0
|
58
|
+
end
|
59
|
+
end
|
data/lib/glib.rb
CHANGED
@@ -84,63 +84,3 @@ module Glib
|
|
84
84
|
return tot == 0
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
88
|
-
class Array
|
89
|
-
def tableprint()
|
90
|
-
long = 0
|
91
|
-
for i in 0..self.length - 1
|
92
|
-
for j in 0..self[i].length - 1
|
93
|
-
if self[i][j].to_s.length > long
|
94
|
-
long = self[i][j].to_s.length
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
for i in 0..self.length - 1
|
100
|
-
for j in 0..self[i].length - 1
|
101
|
-
spaces = " "
|
102
|
-
for k in 1..long - self[i][j].to_s.length
|
103
|
-
spaces = spaces + " "
|
104
|
-
end
|
105
|
-
print self[i][j].to_s + spaces
|
106
|
-
end
|
107
|
-
puts ""
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def normalize(char = ",")
|
112
|
-
concat = ""
|
113
|
-
for i in 0..self.length - 1
|
114
|
-
concat = concat + self[i] + char
|
115
|
-
end
|
116
|
-
return concat[0..-2]
|
117
|
-
end
|
118
|
-
|
119
|
-
def smallest()
|
120
|
-
smallest_index = 0
|
121
|
-
for i in 1..self.length - 1
|
122
|
-
if self[i] < self[smallest_index]
|
123
|
-
smallest_index = i
|
124
|
-
end
|
125
|
-
end
|
126
|
-
return smallest_index
|
127
|
-
end
|
128
|
-
|
129
|
-
def greatest()
|
130
|
-
greatest_index = 0
|
131
|
-
for i in 0..self.length - 1
|
132
|
-
if self[i] > self[greatest_index]
|
133
|
-
greatest_index = i
|
134
|
-
end
|
135
|
-
end
|
136
|
-
return greatest_index
|
137
|
-
end
|
138
|
-
|
139
|
-
def uniform()
|
140
|
-
tot = self.length - 1
|
141
|
-
for i in 1..self.length - 1
|
142
|
-
if self[i] == self[0] then tot-=1 end
|
143
|
-
end
|
144
|
-
return tot == 0
|
145
|
-
end
|
146
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Vian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Testing gem
|
14
14
|
email: casa@gabrielvian.it
|
@@ -16,6 +16,7 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- lib/glib-array.rb
|
19
20
|
- lib/glib.rb
|
20
21
|
homepage: http://rubygems.org/gems/glib
|
21
22
|
licenses:
|
@@ -40,5 +41,5 @@ rubyforge_project:
|
|
40
41
|
rubygems_version: 2.6.13
|
41
42
|
signing_key:
|
42
43
|
specification_version: 4
|
43
|
-
summary:
|
44
|
+
summary: This is a test
|
44
45
|
test_files: []
|