LoremKnight 1.6.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiger.rb +78 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbf0ff8dc3efa175a7df33e8e42b3430f9f6044a
4
- data.tar.gz: b968745282ac2cf41ca2a94ffd4ce95f67452524
3
+ metadata.gz: 2a0abb5ac0cb74b8bb3d7aacb34a26c6f7a9c380
4
+ data.tar.gz: 2c0efbe95351b6be8ac1a6e62b6ba630c5f836c1
5
5
  SHA512:
6
- metadata.gz: 410ba1ff1da6ea5a4ee2954e8f324ef8f4791ed97f1e061ea52890637213552eb9394e2bfc611a37c4bf03062880149cb0b81e362e08372a4eb4ec682edb62e5
7
- data.tar.gz: 850774ce56828d97435a61a1689548db38887ab51ab14fef838c49184915b4c981a1548d129b8e2182a37e89e6d118f96284b94b96ded115f9c85196f3a27ff6
6
+ metadata.gz: e8df7a19ee8a091c62ebee95aa6bb929797a3fe32287266cb78057efefded8cd3bfabdafc68db2eb6340364094d1598291567241b7e1aef59653bad026740a3b
7
+ data.tar.gz: fb715f81929e2a3ee3926668d51af3765133fa5a2bb248179e2f0c753744f948dc60102eb408c9aee12edee35252138fd1a06abb5baf7fd4ea4d95562732dde5
data/lib/tiger.rb CHANGED
@@ -2,29 +2,92 @@ $source_location = File.dirname(__FILE__)
2
2
  require 'open-uri'
3
3
 
4
4
  class Tiger
5
- def self.generate(sentence,words)
6
- @sentence = ""
7
- @content = ""
8
5
 
9
- source = open('https://raw.githubusercontent.com/gugakatsi/LoremKnight/master/lib/words.txt')
6
+ @content = ""
7
+ @paragraphStandartSize = 70;
8
+ @sentenceStandartSize = 7;
10
9
 
11
- source.each do |char|
12
- @content += char
10
+ @doHTML = false
11
+ @doPresentence = false
12
+
13
+ contentFromhttp = ""
14
+ source = open('https://raw.githubusercontent.com/gugakatsi/LoremKnight/master/lib/words.txt')
15
+
16
+ source.each do |char|
17
+ contentFromhttp += char
18
+ end
19
+
20
+ @content = contentFromhttp.split(" ")
21
+
22
+
23
+ def initialize(doHTML,doPresentence)
24
+ end
25
+
26
+ def self.getSentence(sentenceN)
27
+ lorem(sentenceN,@sentenceStandartSize,'')
28
+ end
29
+
30
+ def self.getParagraph(paragraphN)
31
+ lorem(paragraphN,paragraphStandartSize,'')
32
+ end
33
+
34
+ def self.getWords(wordN)
35
+ @words = ""
36
+ wordN.to_i.times do
37
+ @words += @content[rand(@content.size)]+" "
13
38
  end
39
+ return @words
40
+ end
14
41
 
15
- @words = @content.split(" ")
42
+ def self.setSentenceStandartSize(size)
43
+ if size.to_i > 0
44
+ @sentenceStandartSize = size.to_i
45
+ else
46
+ puts "Value can not be less or equal to 0"
47
+ end
48
+ end
16
49
 
17
- sentenceTimes = sentence.to_i
18
- wordTimes = words.to_i
50
+ def self.setParagraphStadartSize(size)
51
+ if size.to_i > 0
52
+ @paragraphStandartSize = size.to_i
53
+ else
54
+ puts "Value can not be less or equal to 0"
55
+ end
56
+ end
57
+
58
+ def self.setWordMaximumLength(length)
59
+ if length.to_i > 0
60
+
61
+ else
19
62
 
20
- sentenceTimes.times do
21
- wordTimes.times do
22
- @sentence += @words[rand(@words.size-1)]+" "
23
- end
24
- @sentence += " , "
25
63
  end
64
+ end
26
65
 
27
- return @sentence
66
+ end
67
+
68
+ def lorem(header,body,startWith = '')
28
69
 
70
+ @sentence = ""
71
+
72
+ header.times do
73
+ body.times do
74
+ @sentence += @content[rand(@content.size)]+" "
75
+ end
76
+ @sentence += startWith == '' ? " /n " : " /n "+@preSentence
29
77
  end
78
+ return @sentence
79
+
80
+ end
81
+
82
+ def loremHTML(header,body,startWith = '')
83
+ @sentenceHTML = ""
84
+
85
+ header.times do
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
92
+
30
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LoremKnight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guga katsiashvili