kieran_gem 0.0.0 → 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.
- checksums.yaml +4 -4
- data/lib/kieran_gem.rb +41 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f2551a55af67a075f4182ac711bd6b7305406701ea8a2607d840084e8dcbd34
|
4
|
+
data.tar.gz: 4d8a6d01ab318854e7b4607630eba829710b6e7df320abb688167983b0fe4c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2bc8316bb9a184b65d2e83bec9bd1826a5ee7a24e0688d6e85b9a0a6b99ef92c2813e3632b8d20a93fb124680365860678897b7f802579428822ef471f77848
|
7
|
+
data.tar.gz: 25f7996957223594fe95e6fd931c1d849bbdcc6523447c28fab98c4ef625494e9666861c2b863c81f7cf07f668fc9bd3a79ea196e36079188bcc2591ccc95483
|
data/lib/kieran_gem.rb
CHANGED
@@ -1,5 +1,44 @@
|
|
1
1
|
class Kieran_gem
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
def self.hi(text ={})
|
4
|
+
|
5
|
+
@result = Hash[*text.flatten]
|
6
|
+
|
7
|
+
|
8
|
+
@words = []
|
9
|
+
@cleanWords =[]
|
10
|
+
|
11
|
+
@result.each do |x|
|
12
|
+
#words = []
|
13
|
+
#@cleanWords =[]
|
14
|
+
#get the values only from the hash
|
15
|
+
values = x.values
|
16
|
+
|
17
|
+
#convert it to string
|
18
|
+
strValue = values.to_s
|
19
|
+
#to utf 8
|
20
|
+
encodedValue = strValue.gsub(160.chr("UTF-8"),"") # this beautiful little function removes -> LIFE SAVER
|
21
|
+
#puts encodedValue
|
22
|
+
# remove html tags
|
23
|
+
rmvHtml = encodedValue.gsub(/(<[^>]*>)|\n|\t/s) {""}
|
24
|
+
|
25
|
+
# remove additional chars
|
26
|
+
rmvExtraChars = rmvHtml.tr('[]',"")
|
27
|
+
# still some chars left, gotta get rid of them
|
28
|
+
again = rmvExtraChars.delete('\\"')
|
29
|
+
#split each by white space
|
30
|
+
#word = again.split(' ')
|
31
|
+
#word is an array covert back to string
|
32
|
+
newWord =again.to_s
|
33
|
+
@words.push(newWord)
|
34
|
+
end
|
35
|
+
#p @words
|
36
|
+
@words.each do |ugh|
|
37
|
+
dog = ugh.split(" ")
|
38
|
+
dog.each do |mouse|
|
39
|
+
@cleanWords.push(mouse)
|
40
|
+
p @cleanWords
|
41
|
+
end
|
42
|
+
end
|
4
43
|
end
|
5
44
|
end
|