betterlorem 0.1.0 → 0.1.1

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 CHANGED
@@ -81,7 +81,7 @@
81
81
 
82
82
  <ul>
83
83
 
84
- <li class="file"><a href="./lorem_txt.html">lorem</a>
84
+ <li class="file"><a href="./lib/lorem_txt.html">lorem</a>
85
85
 
86
86
  </ul>
87
87
  </nav>
@@ -152,7 +152,7 @@ href="http://statebuilt.com">statebuilt.com</a></p>
152
152
 
153
153
  <div class="method-heading">
154
154
  <span class="method-name">c</span><span
155
- class="method-args">(count, line_ending = "<br>", surround_with_tag = "p")</span>
155
+ class="method-args">(count = 100, plainText = false)</span>
156
156
  <span class="method-click-advice">click to toggle source</span>
157
157
  </div>
158
158
 
@@ -164,8 +164,8 @@ href="http://statebuilt.com">statebuilt.com</a></p>
164
164
 
165
165
 
166
166
  <div class="method-source-code" id="c-source">
167
- <pre><span class="ruby-comment"># File lib/betterlorem.rb, line 65</span>
168
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">c</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">line_ending</span> = <span class="ruby-string">&quot;&lt;br&gt;&quot;</span>, <span class="ruby-identifier">surround_with_tag</span> = <span class="ruby-string">&quot;p&quot;</span>)
167
+ <pre><span class="ruby-comment"># File lib/betterlorem.rb, line 73</span>
168
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">c</span>(<span class="ruby-identifier">count</span> = <span class="ruby-value">100</span>, <span class="ruby-identifier">plainText</span> = <span class="ruby-keyword">false</span>)
169
169
  <span class="ruby-identifier">loader</span> = <span class="ruby-constant">Loader</span>.<span class="ruby-identifier">new</span>
170
170
 
171
171
  <span class="ruby-comment"># Merge paragraphs into one line</span>
@@ -190,7 +190,12 @@ href="http://statebuilt.com">statebuilt.com</a></p>
190
190
  <span class="ruby-comment"># Capitalize the sentence</span>
191
191
  <span class="ruby-identifier">sentence</span> = <span class="ruby-identifier">lines</span>[<span class="ruby-identifier">start_inx</span>, <span class="ruby-identifier">count</span>]
192
192
  <span class="ruby-identifier">sentence</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">sentence</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>
193
- <span class="ruby-identifier">sentence</span>
193
+
194
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">plainText</span>
195
+ <span class="ruby-node">&quot;#{sentence}\n&quot;</span>
196
+ <span class="ruby-keyword">else</span>
197
+ <span class="ruby-node">&quot;&lt;p&gt;#{sentence}&lt;/p&gt;&quot;</span>
198
+ <span class="ruby-keyword">end</span>
194
199
  <span class="ruby-keyword">end</span></pre>
195
200
  </div><!-- c-source -->
196
201
 
@@ -206,7 +211,7 @@ href="http://statebuilt.com">statebuilt.com</a></p>
206
211
 
207
212
  <div class="method-heading">
208
213
  <span class="method-name">p</span><span
209
- class="method-args">(count, line_ending = "<br>", surround_with_tag = "p")</span>
214
+ class="method-args">(count = 5, plainText = false)</span>
210
215
  <span class="method-click-advice">click to toggle source</span>
211
216
  </div>
212
217
 
@@ -218,8 +223,8 @@ href="http://statebuilt.com">statebuilt.com</a></p>
218
223
 
219
224
 
220
225
  <div class="method-source-code" id="p-source">
221
- <pre><span class="ruby-comment"># File lib/betterlorem.rb, line 44</span>
222
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">p</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">line_ending</span> = <span class="ruby-string">&quot;&lt;br&gt;&quot;</span>, <span class="ruby-identifier">surround_with_tag</span> = <span class="ruby-string">&quot;p&quot;</span>)
226
+ <pre><span class="ruby-comment"># File lib/betterlorem.rb, line 48</span>
227
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">p</span>(<span class="ruby-identifier">count</span> = <span class="ruby-value">5</span>, <span class="ruby-identifier">plainText</span> = <span class="ruby-keyword">false</span>)
223
228
  <span class="ruby-identifier">loader</span> = <span class="ruby-constant">Loader</span>.<span class="ruby-identifier">new</span>
224
229
 
225
230
  <span class="ruby-comment"># Start at a random index in the array but do not overrun array</span>
@@ -233,10 +238,14 @@ href="http://statebuilt.com">statebuilt.com</a></p>
233
238
 
234
239
  <span class="ruby-comment"># Build final format based on parameters</span>
235
240
  <span class="ruby-identifier">paragraphs</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
236
- <span class="ruby-identifier">line</span> = <span class="ruby-node">&quot;&lt;#{surround_with_tag}&gt;#{line}&lt;/#{surround_with_tag}&gt;#{line_ending}&quot;</span>
241
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">plainText</span>
242
+ <span class="ruby-identifier">line</span> = <span class="ruby-node">&quot;#{line}\n&quot;</span>
243
+ <span class="ruby-keyword">else</span>
244
+ <span class="ruby-identifier">line</span> = <span class="ruby-node">&quot;&lt;p&gt;#{line}&lt;/p&gt;&quot;</span>
245
+ <span class="ruby-keyword">end</span>
237
246
  <span class="ruby-keyword">end</span>
238
247
 
239
- <span class="ruby-identifier">paragraphs</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'\n'</span>)
248
+ <span class="ruby-identifier">paragraphs</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">''</span>)
240
249
  <span class="ruby-keyword">end</span></pre>
241
250
  </div><!-- p-source -->
242
251
 
@@ -252,7 +261,7 @@ href="http://statebuilt.com">statebuilt.com</a></p>
252
261
 
253
262
  <div class="method-heading">
254
263
  <span class="method-name">w</span><span
255
- class="method-args">(count, line_ending = "<br>", surround_with_tag = "p")</span>
264
+ class="method-args">(count = 15, plainText = false)</span>
256
265
  <span class="method-click-advice">click to toggle source</span>
257
266
  </div>
258
267
 
@@ -265,7 +274,7 @@ href="http://statebuilt.com">statebuilt.com</a></p>
265
274
 
266
275
  <div class="method-source-code" id="w-source">
267
276
  <pre><span class="ruby-comment"># File lib/betterlorem.rb, line 16</span>
268
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">w</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">line_ending</span> = <span class="ruby-string">&quot;&lt;br&gt;&quot;</span>, <span class="ruby-identifier">surround_with_tag</span> = <span class="ruby-string">&quot;p&quot;</span>)
277
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">w</span>(<span class="ruby-identifier">count</span> = <span class="ruby-value">15</span>, <span class="ruby-identifier">plainText</span> = <span class="ruby-keyword">false</span>)
269
278
  <span class="ruby-identifier">loader</span> = <span class="ruby-constant">Loader</span>.<span class="ruby-identifier">new</span>
270
279
 
271
280
  <span class="ruby-comment"># Merge paragraphs into one line and split into words</span>
@@ -289,7 +298,11 @@ href="http://statebuilt.com">statebuilt.com</a></p>
289
298
  <span class="ruby-comment"># Correct the sentence's punctuation</span>
290
299
  <span class="ruby-identifier">correct_punctuation</span>(<span class="ruby-identifier">return_words</span>)
291
300
 
292
- <span class="ruby-identifier">return_words</span> = <span class="ruby-node">&quot;&lt;#{surround_with_tag}&gt;#{return_words}&lt;/#{surround_with_tag}&gt;#{line_ending}&quot;</span>
301
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">plainText</span>
302
+ <span class="ruby-node">&quot;#{return_words}\n&quot;</span>
303
+ <span class="ruby-keyword">else</span>
304
+ <span class="ruby-node">&quot;&lt;p&gt;#{return_words}&lt;/p&gt;&quot;</span>
305
+ <span class="ruby-keyword">end</span>
293
306
  <span class="ruby-keyword">end</span></pre>
294
307
  </div><!-- w-source -->
295
308
 
data/doc/created.rid CHANGED
@@ -1,5 +1,5 @@
1
- Tue, 09 Oct 2012 14:31:00 -0500
2
- ./lib/betterlorem.rb Tue, 09 Oct 2012 13:59:59 -0500
3
- ./lorem.txt Tue, 09 Oct 2012 14:17:02 -0500
4
- ./spec/betterlorem_spec.rb Tue, 09 Oct 2012 14:00:51 -0500
5
- ./spec/spec_helper.rb Tue, 09 Oct 2012 13:45:45 -0500
1
+ Tue, 09 Oct 2012 21:44:18 -0500
2
+ ./spec/betterlorem_spec.rb Tue, 09 Oct 2012 21:20:41 -0500
3
+ ./spec/spec_helper.rb Tue, 09 Oct 2012 21:20:41 -0500
4
+ ./lib/betterlorem.rb Tue, 09 Oct 2012 21:20:41 -0500
5
+ ./lib/lorem.txt Tue, 09 Oct 2012 21:20:41 -0500
data/doc/index.html CHANGED
@@ -49,7 +49,7 @@
49
49
 
50
50
  <ul>
51
51
 
52
- <li class="file"><a href="./lorem_txt.html">lorem</a>
52
+ <li class="file"><a href="./lib/lorem_txt.html">lorem</a>
53
53
 
54
54
  </ul>
55
55
  </nav>
@@ -26,7 +26,7 @@
26
26
  <h2>Pages</h2>
27
27
  <ul>
28
28
  <li class="file">
29
- <a href="lorem_txt.html">lorem</a>
29
+ <a href="lib/lorem_txt.html">lorem</a>
30
30
  </li>
31
31
 
32
32
  </ul>
data/lib/betterlorem.rb CHANGED
@@ -38,7 +38,7 @@ module BetterLorem
38
38
  correct_punctuation(return_words)
39
39
 
40
40
  if plainText
41
- "#{return_words}\n"
41
+ "#{return_words}"
42
42
  else
43
43
  "<p>#{return_words}</p>"
44
44
  end
@@ -60,7 +60,7 @@ module BetterLorem
60
60
  # Build final format based on parameters
61
61
  paragraphs.map! do |line|
62
62
  if plainText
63
- line = "#{line}\n"
63
+ line = "#{line}"
64
64
  else
65
65
  line = "<p>#{line}</p>"
66
66
  end
@@ -97,7 +97,7 @@ module BetterLorem
97
97
  sentence[0] = sentence[0].to_s.capitalize
98
98
 
99
99
  if plainText
100
- "#{sentence}\n"
100
+ "#{sentence}"
101
101
  else
102
102
  "<p>#{sentence}</p>"
103
103
  end
@@ -14,7 +14,6 @@ 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
18
17
  lines.should_not == ""
19
18
  end
20
19
  end
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.1.0
4
+ version: 0.1.1
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/table_of_contents.html
26
- - doc/lorem_txt.html
27
- - doc/rdoc.css
28
25
  - doc/created.rid
29
26
  - doc/index.html
27
+ - doc/lorem_txt.html
28
+ - doc/rdoc.css
29
+ - doc/table_of_contents.html
30
30
  homepage: https://github.com/statedigital/BetterLorem
31
31
  licenses: []
32
32
  post_install_message: