LoremKnight 2.0.1 → 2.6.9
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/tiger.rb +30 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05c1bb559d80b0f5b742bb6de7fe5110387f1bca
|
4
|
+
data.tar.gz: 478cb384a88600e47c3c5825ef088ada5fbef1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c837f3a83fca28c51f09d59edfa8c1c1ea8ef7dca69e27c2ce894f168e5e649736dd0590d48c4043e265ff9e37152dd5b579dec959843074bc267539836d5c04
|
7
|
+
data.tar.gz: 0bd495126f30e9f55cdd0cefe4eb8c52bc44a4db08ef61bd306d99d235e834b1072346168037783022478330fbbfdaaa9862544cbd6e89670563f91308140ff5
|
data/lib/tiger.rb
CHANGED
@@ -6,9 +6,10 @@ class Tiger
|
|
6
6
|
@content = ""
|
7
7
|
@paragraphStandartSize = 70;
|
8
8
|
@sentenceStandartSize = 7;
|
9
|
+
@wordLength = 20;
|
9
10
|
|
10
|
-
@
|
11
|
-
@
|
11
|
+
@contentType = "RAW"
|
12
|
+
@hasPreSentence = false
|
12
13
|
|
13
14
|
contentFromhttp = ""
|
14
15
|
source = open('https://raw.githubusercontent.com/gugakatsi/LoremKnight/master/lib/words.txt')
|
@@ -19,10 +20,6 @@ class Tiger
|
|
19
20
|
|
20
21
|
@content = contentFromhttp.split(" ")
|
21
22
|
|
22
|
-
|
23
|
-
def initialize(doHTML,doPresentence)
|
24
|
-
end
|
25
|
-
|
26
23
|
def self.getSentence(sentenceN)
|
27
24
|
lorem(sentenceN,@sentenceStandartSize,'')
|
28
25
|
end
|
@@ -33,10 +30,14 @@ class Tiger
|
|
33
30
|
|
34
31
|
def self.getWords(wordN)
|
35
32
|
@words = ""
|
36
|
-
|
37
|
-
|
33
|
+
@wordArray = @words.split(" ")
|
34
|
+
|
35
|
+
while @wordArray.length < wordN.to_i do
|
36
|
+
pendingWord = @content[rand(@content.size)]
|
37
|
+
@words += pendingWord.length <= @wordLength ? pendingWord+" " : ""
|
38
|
+
@wordArray = @words.split(" ")
|
38
39
|
end
|
39
|
-
return @words
|
40
|
+
return @words;
|
40
41
|
end
|
41
42
|
|
42
43
|
def self.setSentenceStandartSize(size)
|
@@ -47,7 +48,7 @@ class Tiger
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
def self.
|
51
|
+
def self.setParagraphStandartSize(size)
|
51
52
|
if size.to_i > 0
|
52
53
|
@paragraphStandartSize = size.to_i
|
53
54
|
else
|
@@ -57,37 +58,40 @@ class Tiger
|
|
57
58
|
|
58
59
|
def self.setWordMaximumLength(length)
|
59
60
|
if length.to_i > 0
|
60
|
-
|
61
|
+
@wordLength = length.to_i
|
61
62
|
else
|
63
|
+
puts "Value can not be less than or equal to 0"
|
64
|
+
end
|
65
|
+
end
|
62
66
|
|
67
|
+
def self.setContentType(type)
|
68
|
+
case(type.to_s)
|
69
|
+
when "html"
|
70
|
+
@contentType = "text/html"
|
71
|
+
when "raw"
|
72
|
+
@contentType = "RAW"
|
73
|
+
else
|
74
|
+
@contentType = "RAW"
|
63
75
|
end
|
64
76
|
end
|
65
77
|
|
78
|
+
def self.hasPreSentence(has)
|
79
|
+
@hasPreSentence = has
|
80
|
+
end
|
66
81
|
end
|
67
82
|
|
68
83
|
def lorem(header,body,startWith = '')
|
69
84
|
|
70
|
-
@
|
85
|
+
@preSentence = @hasPreSentence == true ? "რომელმან შექმნა სამყარო" : ""
|
86
|
+
@sentence = @contentType == 'text/html' ? "<p> #{@preSentence} " : " #{@preSentence} "
|
71
87
|
|
72
88
|
header.times do
|
73
89
|
body.times do
|
74
90
|
@sentence += @content[rand(@content.size)]+" "
|
75
91
|
end
|
76
|
-
@sentence +=
|
92
|
+
@sentence += @contentType == 'text/html' ? " </p> <br> <br> <p> #{@preSentence} " : " /n #{@preSentence} "
|
77
93
|
end
|
78
|
-
return @sentence
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
def loremHTML(header,body,startWith = '')
|
83
|
-
@sentenceHTML = ""
|
84
94
|
|
85
|
-
|
86
|
-
body.times do
|
87
|
-
@sentenceHTML += @content[rand(@content.size)]+" "
|
88
|
-
end
|
89
|
-
@sentenceHTML += startWith == '' ? "</p> <br> <br> " : "</p> <br> <br> "+@preSentence
|
90
|
-
end
|
91
|
-
return @sentence
|
95
|
+
return @sentence
|
92
96
|
|
93
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: LoremKnight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guga katsiashvili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'lorem generating words from georgian epic poem : The Knight in the Panther''s
|
14
14
|
Skin'
|