LoremKnight 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/tiger.rb +30 -0
- data/lib/words.txt +1 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 03cd2b8d079d06c61b73192c9480e0d43b44e523
|
4
|
+
data.tar.gz: c0c80a799740f01fc38cc69032d0b487c7632fb0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8125de04c997086c5d30dd4ec10d342fbecfd9c949c12f3031cf3227c8d2d292321d07c13bfacb0e890f4725760c6073a2f04c4ef265056c7eef9bfe6c2e1578
|
7
|
+
data.tar.gz: 3256dbc2ae0bd88006ffb76233c5b649df0a97b18e2f2e59935b0b4fa1ab3026946ba1a4ba6cd1ee0155c1a1b67a659145611a2106c07e30294d2104526bbbc8
|
data/lib/tiger.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
$source_location = File.dirname(__FILE__)
|
2
|
+
class Tiger
|
3
|
+
def self.generate(sentence,words,filename)
|
4
|
+
@sentence = ""
|
5
|
+
|
6
|
+
file = File.new("#{$source_location}/words.txt","r+")
|
7
|
+
tofile = File.new("#{filename.to_s}","w+")
|
8
|
+
|
9
|
+
if file
|
10
|
+
content = file.sysread(file.size)
|
11
|
+
@words = content.split(" ")
|
12
|
+
else
|
13
|
+
puts "unable to locate Knight's source file"
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
sentenceTimes = sentence.to_i
|
18
|
+
wordTimes = words.to_i
|
19
|
+
|
20
|
+
sentenceTimes.times do
|
21
|
+
wordTimes.times do
|
22
|
+
tofile.syswrite(@words[rand(@words.size)]+" ")
|
23
|
+
end
|
24
|
+
print "\n"
|
25
|
+
tofile.syswrite("\n")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#require_relative("#{$source_location}/words.txt")
|