betterlorem 0.0.8 → 0.0.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.
- data/doc/BetterLorem.html +1 -1
- data/lib/betterlorem.rb +13 -13
- data/spec/betterlorem_spec.rb +3 -2
- metadata +4 -4
data/doc/BetterLorem.html
CHANGED
@@ -108,7 +108,7 @@
|
|
108
108
|
|
109
109
|
<p><a href="BetterLorem.html">BetterLorem</a></p>
|
110
110
|
|
111
|
-
<p>A better Lorem
|
111
|
+
<p>A better Lorem Ipsum generator</p>
|
112
112
|
|
113
113
|
<p>Created By Caedmon Judd (caedmon@statebuilt.com) <a
|
114
114
|
href="http://statebuilt.com">statebuilt.com</a></p>
|
data/lib/betterlorem.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BetterLorem
|
2
2
|
#
|
3
|
-
# A better Lorem
|
3
|
+
# A better Lorem Ipsum generator
|
4
4
|
#
|
5
5
|
# Created By Caedmon Judd (caedmon@statebuilt.com)
|
6
6
|
# http://statebuilt.com
|
@@ -13,7 +13,7 @@ module BetterLorem
|
|
13
13
|
PUNCTUATION = ['.', ',', '!', '?', ':']
|
14
14
|
|
15
15
|
# Return Words
|
16
|
-
def self.w(count
|
16
|
+
def self.w(count = 15, plainText = false)
|
17
17
|
loader = Loader.new
|
18
18
|
|
19
19
|
# Merge paragraphs into one line and split into words
|
@@ -37,15 +37,15 @@ module BetterLorem
|
|
37
37
|
# Correct the sentence's punctuation
|
38
38
|
correct_punctuation(return_words)
|
39
39
|
|
40
|
-
if
|
41
|
-
"#{return_words}
|
40
|
+
if plainText
|
41
|
+
"#{return_words}\n"
|
42
42
|
else
|
43
|
-
"
|
43
|
+
"<p>#{return_words}</p>"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
# Return Paragraphs
|
48
|
-
def self.p(count
|
48
|
+
def self.p(count = 5, plainText = false)
|
49
49
|
loader = Loader.new
|
50
50
|
|
51
51
|
# Start at a random index in the array but do not overrun array
|
@@ -59,10 +59,10 @@ module BetterLorem
|
|
59
59
|
|
60
60
|
# Build final format based on parameters
|
61
61
|
paragraphs.map! do |line|
|
62
|
-
if
|
63
|
-
line = "#{line}
|
62
|
+
if plainText
|
63
|
+
line = "#{line}\n"
|
64
64
|
else
|
65
|
-
line = "
|
65
|
+
line = "<p>#{line}</p>"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -70,7 +70,7 @@ module BetterLorem
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# Return Characters
|
73
|
-
def self.c(count
|
73
|
+
def self.c(count = 100, plainText = false)
|
74
74
|
loader = Loader.new
|
75
75
|
|
76
76
|
# Merge paragraphs into one line
|
@@ -96,10 +96,10 @@ module BetterLorem
|
|
96
96
|
sentence = lines[start_inx, count]
|
97
97
|
sentence[0] = sentence[0].to_s.capitalize
|
98
98
|
|
99
|
-
if
|
100
|
-
"#{sentence}
|
99
|
+
if plainText
|
100
|
+
"#{sentence}\n"
|
101
101
|
else
|
102
|
-
"
|
102
|
+
"<p>#{sentence}</p>"
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
data/spec/betterlorem_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require '
|
2
|
+
require 'betterlorem'
|
3
3
|
|
4
4
|
describe BetterLorem do
|
5
5
|
|
@@ -14,6 +14,7 @@ describe BetterLorem do
|
|
14
14
|
describe ".p" do
|
15
15
|
it "should return 3 paragraphs" do
|
16
16
|
lines = BetterLorem.p(3)
|
17
|
+
puts lines
|
17
18
|
lines.should_not == ""
|
18
19
|
end
|
19
20
|
end
|
@@ -21,7 +22,7 @@ describe BetterLorem do
|
|
21
22
|
describe ".c" do
|
22
23
|
it "should return 100 characters" do
|
23
24
|
chars = BetterLorem.c(100)
|
24
|
-
chars.length.should ==
|
25
|
+
chars.length.should == 107 # 107 with HTML tags
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlorem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -22,11 +22,11 @@ files:
|
|
22
22
|
- spec/betterlorem_spec.rb
|
23
23
|
- spec/spec_helper.rb
|
24
24
|
- doc/BetterLorem.html
|
25
|
-
- doc/
|
26
|
-
- doc/index.html
|
25
|
+
- doc/table_of_contents.html
|
27
26
|
- doc/lorem_txt.html
|
28
27
|
- doc/rdoc.css
|
29
|
-
- doc/
|
28
|
+
- doc/created.rid
|
29
|
+
- doc/index.html
|
30
30
|
homepage: https://github.com/statedigital/BetterLorem
|
31
31
|
licenses: []
|
32
32
|
post_install_message:
|