lazier 3.4.2 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +3 -3
- data/doc/Lazier.html +1 -1
- data/doc/Lazier/Boolean.html +1 -1
- data/doc/Lazier/Configuration.html +1 -1
- data/doc/Lazier/DateTime.html +1 -1
- data/doc/Lazier/DateTime/ClassMethods.html +1 -1
- data/doc/Lazier/Exceptions.html +1 -1
- data/doc/Lazier/Exceptions/Debug.html +1 -1
- data/doc/Lazier/Exceptions/MissingTranslation.html +1 -1
- data/doc/Lazier/Hash.html +1 -1
- data/doc/Lazier/I18n.html +1 -1
- data/doc/Lazier/Localizer.html +1 -1
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +1 -1
- data/doc/Lazier/Object.html +1 -1
- data/doc/Lazier/Pathname.html +1 -1
- data/doc/Lazier/Settings.html +1 -1
- data/doc/Lazier/String.html +161 -1
- data/doc/Lazier/TimeZone.html +1 -1
- data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
- data/doc/Lazier/Version.html +3 -3
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +34 -28
- data/doc/top-level-namespace.html +1 -1
- data/lib/lazier/string.rb +15 -0
- data/lib/lazier/version.rb +2 -2
- data/spec/lazier/string_spec.rb +11 -0
- 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: 978254a214fff223e7131dc86622875b3fb86adf
|
4
|
+
data.tar.gz: 9e28d70c6818dc11a2bbdbdf836a34f7d53c6e56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 817de72185f75362dcddb1c6454df301492f4625377c604ae7f34c08a3d87276a3d831991ff515cf3bff41dc3a268b71ae6da501438ae285769ed9a7c6f37474
|
7
|
+
data.tar.gz: 3ac68744df6f81de54f60104cd359f55e6f5607a418ced2adf8a23eed01a724aa44cc29664c6e9fa5a3d9d9530ff534908cf549fec700cc5a885b7469e3b8ae0
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -10,12 +10,12 @@ gemspec
|
|
10
10
|
|
11
11
|
# Testing
|
12
12
|
gem "rspec", "~> 2.14.1"
|
13
|
-
gem "rake", "~> 10.1.
|
13
|
+
gem "rake", "~> 10.1.1"
|
14
14
|
|
15
15
|
# Documentation
|
16
16
|
gem "simplecov", ">= 0.8.2"
|
17
17
|
gem "coveralls", ">= 0.7.0", require: false
|
18
18
|
gem "pry", ">= 0"
|
19
19
|
gem "yard", ">= 0.8.7"
|
20
|
-
gem "kramdown", ">= 1.3.
|
21
|
-
gem "github-markup", ">= 1.0.
|
20
|
+
gem "kramdown", ">= 1.3.2"
|
21
|
+
gem "github-markup", ">= 1.0.2"
|
data/doc/Lazier.html
CHANGED
@@ -1166,7 +1166,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
1166
1166
|
</div>
|
1167
1167
|
|
1168
1168
|
<div id="footer">
|
1169
|
-
Generated on
|
1169
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
1170
1170
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1171
1171
|
0.8.7.3 (ruby-2.1.0).
|
1172
1172
|
</div>
|
data/doc/Lazier/Boolean.html
CHANGED
@@ -288,7 +288,7 @@
|
|
288
288
|
</div>
|
289
289
|
|
290
290
|
<div id="footer">
|
291
|
-
Generated on
|
291
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
292
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
293
293
|
0.8.7.3 (ruby-2.1.0).
|
294
294
|
</div>
|
@@ -386,7 +386,7 @@ Options are as follows:</p>
|
|
386
386
|
</div>
|
387
387
|
|
388
388
|
<div id="footer">
|
389
|
-
Generated on
|
389
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
390
390
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
391
391
|
0.8.7.3 (ruby-2.1.0).
|
392
392
|
</div>
|
data/doc/Lazier/DateTime.html
CHANGED
@@ -721,7 +721,7 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
721
721
|
</div>
|
722
722
|
|
723
723
|
<div id="footer">
|
724
|
-
Generated on
|
724
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
725
725
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
726
726
|
0.8.7.3 (ruby-2.1.0).
|
727
727
|
</div>
|
@@ -1542,7 +1542,7 @@ Date.years(1, true, 2010, true)
|
|
1542
1542
|
</div>
|
1543
1543
|
|
1544
1544
|
<div id="footer">
|
1545
|
-
Generated on
|
1545
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
1546
1546
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1547
1547
|
0.8.7.3 (ruby-2.1.0).
|
1548
1548
|
</div>
|
data/doc/Lazier/Exceptions.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.7.3 (ruby-2.1.0).
|
122
122
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on
|
127
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.7.3 (ruby-2.1.0).
|
130
130
|
</div>
|
@@ -238,7 +238,7 @@
|
|
238
238
|
</div>
|
239
239
|
|
240
240
|
<div id="footer">
|
241
|
-
Generated on
|
241
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
242
242
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
243
243
|
0.8.7.3 (ruby-2.1.0).
|
244
244
|
</div>
|
data/doc/Lazier/Hash.html
CHANGED
@@ -543,7 +543,7 @@
|
|
543
543
|
</div>
|
544
544
|
|
545
545
|
<div id="footer">
|
546
|
-
Generated on
|
546
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
547
547
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
548
548
|
0.8.7.3 (ruby-2.1.0).
|
549
549
|
</div>
|
data/doc/Lazier/I18n.html
CHANGED
@@ -1070,7 +1070,7 @@
|
|
1070
1070
|
</div>
|
1071
1071
|
|
1072
1072
|
<div id="footer">
|
1073
|
-
Generated on
|
1073
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
1074
1074
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1075
1075
|
0.8.7.3 (ruby-2.1.0).
|
1076
1076
|
</div>
|
data/doc/Lazier/Localizer.html
CHANGED
@@ -536,7 +536,7 @@
|
|
536
536
|
</div>
|
537
537
|
|
538
538
|
<div id="footer">
|
539
|
-
Generated on
|
539
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
540
540
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
541
541
|
0.8.7.3 (ruby-2.1.0).
|
542
542
|
</div>
|
data/doc/Lazier/Math.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.8.7.3 (ruby-2.1.0).
|
127
127
|
</div>
|
@@ -321,7 +321,7 @@
|
|
321
321
|
</div>
|
322
322
|
|
323
323
|
<div id="footer">
|
324
|
-
Generated on
|
324
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
325
325
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
326
326
|
0.8.7.3 (ruby-2.1.0).
|
327
327
|
</div>
|
data/doc/Lazier/Object.html
CHANGED
@@ -2203,7 +2203,7 @@
|
|
2203
2203
|
</div>
|
2204
2204
|
|
2205
2205
|
<div id="footer">
|
2206
|
-
Generated on
|
2206
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
2207
2207
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2208
2208
|
0.8.7.3 (ruby-2.1.0).
|
2209
2209
|
</div>
|
data/doc/Lazier/Pathname.html
CHANGED
@@ -213,7 +213,7 @@ Pathname.new("/usr/bin/ruby").components
|
|
213
213
|
</div>
|
214
214
|
|
215
215
|
<div id="footer">
|
216
|
-
Generated on
|
216
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
217
217
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
218
218
|
0.8.7.3 (ruby-2.1.0).
|
219
219
|
</div>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -2405,7 +2405,7 @@
|
|
2405
2405
|
</div>
|
2406
2406
|
|
2407
2407
|
<div id="footer">
|
2408
|
-
Generated on
|
2408
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
2409
2409
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2410
2410
|
0.8.7.3 (ruby-2.1.0).
|
2411
2411
|
</div>
|
data/doc/Lazier/String.html
CHANGED
@@ -179,6 +179,29 @@
|
|
179
179
|
<span class="summary_desc"><div class='inline'><p>Returns the string with all <code>&amp;</code> replaced with <code>&</code>.</p>
|
180
180
|
</div></span>
|
181
181
|
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#split_tokens-instance_method" title="#split_tokens (instance method)">- (Array) <strong>split_tokens</strong>(no_blanks = true, strip = true, uniq = false, pattern = /\s*,\s*/) </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Splits a string containing tokens using a specified pattern and applying some sanitizations.</p>
|
203
|
+
</div></span>
|
204
|
+
|
182
205
|
</li>
|
183
206
|
|
184
207
|
|
@@ -435,6 +458,143 @@
|
|
435
458
|
</td>
|
436
459
|
</tr>
|
437
460
|
</table>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
<div class="method_details ">
|
464
|
+
<h3 class="signature " id="split_tokens-instance_method">
|
465
|
+
|
466
|
+
- (<tt>Array</tt>) <strong>split_tokens</strong>(no_blanks = true, strip = true, uniq = false, pattern = /\s*,\s*/)
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
</h3><div class="docstring">
|
473
|
+
<div class="discussion">
|
474
|
+
<p>Splits a string containing tokens using a specified pattern and applying some sanitizations.</p>
|
475
|
+
|
476
|
+
|
477
|
+
</div>
|
478
|
+
</div>
|
479
|
+
<div class="tags">
|
480
|
+
<p class="tag_title">Parameters:</p>
|
481
|
+
<ul class="param">
|
482
|
+
|
483
|
+
<li>
|
484
|
+
|
485
|
+
<span class='name'>no_blanks</span>
|
486
|
+
|
487
|
+
|
488
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
489
|
+
|
490
|
+
|
491
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
492
|
+
|
493
|
+
|
494
|
+
—
|
495
|
+
<div class='inline'><p>If filter out blank tokens.</p>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
</li>
|
499
|
+
|
500
|
+
<li>
|
501
|
+
|
502
|
+
<span class='name'>strip</span>
|
503
|
+
|
504
|
+
|
505
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
506
|
+
|
507
|
+
|
508
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
509
|
+
|
510
|
+
|
511
|
+
—
|
512
|
+
<div class='inline'><p>If strip single tokens.</p>
|
513
|
+
</div>
|
514
|
+
|
515
|
+
</li>
|
516
|
+
|
517
|
+
<li>
|
518
|
+
|
519
|
+
<span class='name'>uniq</span>
|
520
|
+
|
521
|
+
|
522
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
523
|
+
|
524
|
+
|
525
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
526
|
+
|
527
|
+
|
528
|
+
—
|
529
|
+
<div class='inline'><p>If return uniques elements.</p>
|
530
|
+
</div>
|
531
|
+
|
532
|
+
</li>
|
533
|
+
|
534
|
+
<li>
|
535
|
+
|
536
|
+
<span class='name'>pattern</span>
|
537
|
+
|
538
|
+
|
539
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::String (module)">String</a></span>|Regexp</tt>)</span>
|
540
|
+
|
541
|
+
|
542
|
+
<em class="default">(defaults to: <tt>/\s*,\s*/</tt>)</em>
|
543
|
+
|
544
|
+
|
545
|
+
—
|
546
|
+
<div class='inline'><p>The pattern to use.</p>
|
547
|
+
</div>
|
548
|
+
|
549
|
+
</li>
|
550
|
+
|
551
|
+
</ul>
|
552
|
+
|
553
|
+
<p class="tag_title">Returns:</p>
|
554
|
+
<ul class="return">
|
555
|
+
|
556
|
+
<li>
|
557
|
+
|
558
|
+
|
559
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
—
|
564
|
+
<div class='inline'><p>An array of tokens.</p>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
</li>
|
568
|
+
|
569
|
+
</ul>
|
570
|
+
|
571
|
+
</div><table class="source_code">
|
572
|
+
<tr>
|
573
|
+
<td>
|
574
|
+
<pre class="lines">
|
575
|
+
|
576
|
+
|
577
|
+
68
|
578
|
+
69
|
579
|
+
70
|
580
|
+
71
|
581
|
+
72
|
582
|
+
73
|
583
|
+
74</pre>
|
584
|
+
</td>
|
585
|
+
<td>
|
586
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/string.rb', line 68</span>
|
587
|
+
|
588
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_split_tokens'>split_tokens</span><span class='lparen'>(</span><span class='id identifier rubyid_no_blanks'>no_blanks</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_strip'>strip</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_pattern'>pattern</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s*,\s*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
589
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span>
|
590
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_map!'>map!</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_strip'>strip</span>
|
591
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_select!'>select!</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:present?</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_no_blanks'>no_blanks</span>
|
592
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span> <span class='kw'>if</span> <span class='id identifier rubyid_uniq'>uniq</span>
|
593
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
594
|
+
<span class='kw'>end</span></pre>
|
595
|
+
</td>
|
596
|
+
</tr>
|
597
|
+
</table>
|
438
598
|
</div>
|
439
599
|
|
440
600
|
<div class="method_details ">
|
@@ -563,7 +723,7 @@
|
|
563
723
|
</div>
|
564
724
|
|
565
725
|
<div id="footer">
|
566
|
-
Generated on
|
726
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
567
727
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
568
728
|
0.8.7.3 (ruby-2.1.0).
|
569
729
|
</div>
|
data/doc/Lazier/TimeZone.html
CHANGED
@@ -1663,7 +1663,7 @@
|
|
1663
1663
|
</div>
|
1664
1664
|
|
1665
1665
|
<div id="footer">
|
1666
|
-
Generated on
|
1666
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
1667
1667
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1668
1668
|
0.8.7.3 (ruby-2.1.0).
|
1669
1669
|
</div>
|
@@ -1015,7 +1015,7 @@ DateTime.parameterize_zone(ActiveSupport::TimeZone["Pacific Time (US & Canad
|
|
1015
1015
|
</div>
|
1016
1016
|
|
1017
1017
|
<div id="footer">
|
1018
|
-
Generated on
|
1018
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
1019
1019
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1020
1020
|
0.8.7.3 (ruby-2.1.0).
|
1021
1021
|
</div>
|
data/doc/Lazier/Version.html
CHANGED
@@ -134,7 +134,7 @@
|
|
134
134
|
|
135
135
|
</div>
|
136
136
|
</dt>
|
137
|
-
<dd><pre class="code"><span class='int'>
|
137
|
+
<dd><pre class="code"><span class='int'>5</span></pre></dd>
|
138
138
|
|
139
139
|
<dt id="PATCH-constant" class="">PATCH =
|
140
140
|
<div class="docstring">
|
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>0</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Sun Feb 16 13:46:56 2014 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.7.3 (ruby-2.1.0).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -333,7 +333,7 @@
|
|
333
333
|
</div>
|
334
334
|
|
335
335
|
<div id="footer">
|
336
|
-
Generated on
|
336
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
337
337
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
338
338
|
0.8.7.3 (ruby-2.1.0).
|
339
339
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -106,7 +106,7 @@ See documentation for more informations.</p>
|
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
111
|
0.8.7.3 (ruby-2.1.0).
|
112
112
|
</div>
|
data/doc/index.html
CHANGED
@@ -106,7 +106,7 @@ See documentation for more informations.</p>
|
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
111
|
0.8.7.3 (ruby-2.1.0).
|
112
112
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -300,26 +300,26 @@
|
|
300
300
|
|
301
301
|
|
302
302
|
<li class="r1 ">
|
303
|
-
<span class='object_link'><a href="Lazier/
|
304
|
-
<small>Lazier::
|
303
|
+
<span class='object_link'><a href="Lazier/Configuration.html#initialize-instance_method" title="Lazier::Configuration#initialize (method)">#initialize</a></span>
|
304
|
+
<small>Lazier::Configuration</small>
|
305
305
|
</li>
|
306
306
|
|
307
307
|
|
308
308
|
<li class="r2 ">
|
309
|
-
<span class='object_link'><a href="Lazier/
|
310
|
-
<small>Lazier::
|
309
|
+
<span class='object_link'><a href="Lazier/Localizer.html#initialize-instance_method" title="Lazier::Localizer#initialize (method)">#initialize</a></span>
|
310
|
+
<small>Lazier::Localizer</small>
|
311
311
|
</li>
|
312
312
|
|
313
313
|
|
314
314
|
<li class="r1 ">
|
315
|
-
<span class='object_link'><a href="Lazier/
|
316
|
-
<small>Lazier::
|
315
|
+
<span class='object_link'><a href="Lazier/Exceptions/MissingTranslation.html#initialize-instance_method" title="Lazier::Exceptions::MissingTranslation#initialize (method)">#initialize</a></span>
|
316
|
+
<small>Lazier::Exceptions::MissingTranslation</small>
|
317
317
|
</li>
|
318
318
|
|
319
319
|
|
320
320
|
<li class="r2 ">
|
321
|
-
<span class='object_link'><a href="Lazier/
|
322
|
-
<small>Lazier::
|
321
|
+
<span class='object_link'><a href="Lazier/Settings.html#initialize-instance_method" title="Lazier::Settings#initialize (method)">#initialize</a></span>
|
322
|
+
<small>Lazier::Settings</small>
|
323
323
|
</li>
|
324
324
|
|
325
325
|
|
@@ -486,14 +486,14 @@
|
|
486
486
|
|
487
487
|
|
488
488
|
<li class="r2 ">
|
489
|
-
<span class='object_link'><a href="Lazier/
|
490
|
-
<small>Lazier::
|
489
|
+
<span class='object_link'><a href="Lazier/TimeZone/ClassMethods.html#parameterize_zone-instance_method" title="Lazier::TimeZone::ClassMethods#parameterize_zone (method)">#parameterize_zone</a></span>
|
490
|
+
<small>Lazier::TimeZone::ClassMethods</small>
|
491
491
|
</li>
|
492
492
|
|
493
493
|
|
494
494
|
<li class="r1 ">
|
495
|
-
<span class='object_link'><a href="Lazier/
|
496
|
-
<small>Lazier::
|
495
|
+
<span class='object_link'><a href="Lazier/DateTime/ClassMethods.html#parameterize_zone-instance_method" title="Lazier::DateTime::ClassMethods#parameterize_zone (method)">#parameterize_zone</a></span>
|
496
|
+
<small>Lazier::DateTime::ClassMethods</small>
|
497
497
|
</li>
|
498
498
|
|
499
499
|
|
@@ -576,102 +576,108 @@
|
|
576
576
|
|
577
577
|
|
578
578
|
<li class="r1 ">
|
579
|
+
<span class='object_link'><a href="Lazier/String.html#split_tokens-instance_method" title="Lazier::String#split_tokens (method)">#split_tokens</a></span>
|
580
|
+
<small>Lazier::String</small>
|
581
|
+
</li>
|
582
|
+
|
583
|
+
|
584
|
+
<li class="r2 ">
|
579
585
|
<span class='object_link'><a href="Lazier/DateTime/ClassMethods.html#timezones-instance_method" title="Lazier::DateTime::ClassMethods#timezones (method)">#timezones</a></span>
|
580
586
|
<small>Lazier::DateTime::ClassMethods</small>
|
581
587
|
</li>
|
582
588
|
|
583
589
|
|
584
|
-
<li class="
|
590
|
+
<li class="r1 ">
|
585
591
|
<span class='object_link'><a href="Lazier/Object.html#to_boolean-instance_method" title="Lazier::Object#to_boolean (method)">#to_boolean</a></span>
|
586
592
|
<small>Lazier::Object</small>
|
587
593
|
</li>
|
588
594
|
|
589
595
|
|
590
|
-
<li class="
|
596
|
+
<li class="r2 ">
|
591
597
|
<span class='object_link'><a href="Lazier/Object.html#to_float-instance_method" title="Lazier::Object#to_float (method)">#to_float</a></span>
|
592
598
|
<small>Lazier::Object</small>
|
593
599
|
</li>
|
594
600
|
|
595
601
|
|
596
|
-
<li class="
|
602
|
+
<li class="r1 ">
|
597
603
|
<span class='object_link'><a href="Lazier/Boolean.html#to_i-instance_method" title="Lazier::Boolean#to_i (method)">#to_i</a></span>
|
598
604
|
<small>Lazier::Boolean</small>
|
599
605
|
</li>
|
600
606
|
|
601
607
|
|
602
|
-
<li class="
|
608
|
+
<li class="r2 ">
|
603
609
|
<span class='object_link'><a href="Lazier/Object.html#to_integer-instance_method" title="Lazier::Object#to_integer (method)">#to_integer</a></span>
|
604
610
|
<small>Lazier::Object</small>
|
605
611
|
</li>
|
606
612
|
|
607
613
|
|
608
|
-
<li class="
|
614
|
+
<li class="r1 ">
|
609
615
|
<span class='object_link'><a href="Lazier/TimeZone.html#to_str-instance_method" title="Lazier::TimeZone#to_str (method)">#to_str</a></span>
|
610
616
|
<small>Lazier::TimeZone</small>
|
611
617
|
</li>
|
612
618
|
|
613
619
|
|
614
|
-
<li class="
|
620
|
+
<li class="r2 ">
|
615
621
|
<span class='object_link'><a href="Lazier/TimeZone.html#to_str_parameterized-instance_method" title="Lazier::TimeZone#to_str_parameterized (method)">#to_str_parameterized</a></span>
|
616
622
|
<small>Lazier::TimeZone</small>
|
617
623
|
</li>
|
618
624
|
|
619
625
|
|
620
|
-
<li class="
|
626
|
+
<li class="r1 ">
|
621
627
|
<span class='object_link'><a href="Lazier/TimeZone.html#to_str_with_dst-instance_method" title="Lazier::TimeZone#to_str_with_dst (method)">#to_str_with_dst</a></span>
|
622
628
|
<small>Lazier::TimeZone</small>
|
623
629
|
</li>
|
624
630
|
|
625
631
|
|
626
|
-
<li class="
|
632
|
+
<li class="r2 ">
|
627
633
|
<span class='object_link'><a href="Lazier/TimeZone.html#to_str_with_dst_parameterized-instance_method" title="Lazier::TimeZone#to_str_with_dst_parameterized (method)">#to_str_with_dst_parameterized</a></span>
|
628
634
|
<small>Lazier::TimeZone</small>
|
629
635
|
</li>
|
630
636
|
|
631
637
|
|
632
|
-
<li class="
|
638
|
+
<li class="r1 ">
|
633
639
|
<span class='object_link'><a href="Lazier/DateTime/ClassMethods.html#unparameterize_zone-instance_method" title="Lazier::DateTime::ClassMethods#unparameterize_zone (method)">#unparameterize_zone</a></span>
|
634
640
|
<small>Lazier::DateTime::ClassMethods</small>
|
635
641
|
</li>
|
636
642
|
|
637
643
|
|
638
|
-
<li class="
|
644
|
+
<li class="r2 ">
|
639
645
|
<span class='object_link'><a href="Lazier/TimeZone/ClassMethods.html#unparameterize_zone-instance_method" title="Lazier::TimeZone::ClassMethods#unparameterize_zone (method)">#unparameterize_zone</a></span>
|
640
646
|
<small>Lazier::TimeZone::ClassMethods</small>
|
641
647
|
</li>
|
642
648
|
|
643
649
|
|
644
|
-
<li class="
|
650
|
+
<li class="r1 ">
|
645
651
|
<span class='object_link'><a href="Lazier/String.html#untitleize-instance_method" title="Lazier::String#untitleize (method)">#untitleize</a></span>
|
646
652
|
<small>Lazier::String</small>
|
647
653
|
</li>
|
648
654
|
|
649
655
|
|
650
|
-
<li class="
|
656
|
+
<li class="r2 ">
|
651
657
|
<span class='object_link'><a href="Lazier/TimeZone.html#uses_dst%3F-instance_method" title="Lazier::TimeZone#uses_dst? (method)">#uses_dst?</a></span>
|
652
658
|
<small>Lazier::TimeZone</small>
|
653
659
|
</li>
|
654
660
|
|
655
661
|
|
656
|
-
<li class="
|
662
|
+
<li class="r1 ">
|
657
663
|
<span class='object_link'><a href="Lazier/DateTime.html#utc_time-instance_method" title="Lazier::DateTime#utc_time (method)">#utc_time</a></span>
|
658
664
|
<small>Lazier::DateTime</small>
|
659
665
|
</li>
|
660
666
|
|
661
667
|
|
662
|
-
<li class="
|
668
|
+
<li class="r2 ">
|
663
669
|
<span class='object_link'><a href="Lazier/String.html#value-instance_method" title="Lazier::String#value (method)">#value</a></span>
|
664
670
|
<small>Lazier::String</small>
|
665
671
|
</li>
|
666
672
|
|
667
673
|
|
668
|
-
<li class="
|
674
|
+
<li class="r1 ">
|
669
675
|
<span class='object_link'><a href="Lazier/Boolean.html#value-instance_method" title="Lazier::Boolean#value (method)">#value</a></span>
|
670
676
|
<small>Lazier::Boolean</small>
|
671
677
|
</li>
|
672
678
|
|
673
679
|
|
674
|
-
<li class="
|
680
|
+
<li class="r2 ">
|
675
681
|
<span class='object_link'><a href="Lazier/DateTime/ClassMethods.html#years-instance_method" title="Lazier::DateTime::ClassMethods#years (method)">#years</a></span>
|
676
682
|
<small>Lazier::DateTime::ClassMethods</small>
|
677
683
|
</li>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Sun Feb 16 13:46:55 2014 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.3 (ruby-2.1.0).
|
109
109
|
</div>
|
data/lib/lazier/string.rb
CHANGED
@@ -57,5 +57,20 @@ module Lazier
|
|
57
57
|
def value
|
58
58
|
self
|
59
59
|
end
|
60
|
+
|
61
|
+
# Splits a string containing tokens using a specified pattern and applying some sanitizations.
|
62
|
+
#
|
63
|
+
# @param no_blanks [Boolean] If filter out blank tokens.
|
64
|
+
# @param strip [Boolean] If strip single tokens.
|
65
|
+
# @param uniq [Boolean] If return uniques elements.
|
66
|
+
# @param pattern [String|Regexp] The pattern to use.
|
67
|
+
# @return [Array] An array of tokens.
|
68
|
+
def split_tokens(no_blanks = true, strip = true, uniq = false, pattern = /\s*,\s*/)
|
69
|
+
rv = self.split(pattern)
|
70
|
+
rv.map!(&:strip) if strip
|
71
|
+
rv.select!(&:present?) if no_blanks
|
72
|
+
rv.uniq! if uniq
|
73
|
+
rv
|
74
|
+
end
|
60
75
|
end
|
61
76
|
end
|
data/lib/lazier/version.rb
CHANGED
data/spec/lazier/string_spec.rb
CHANGED
@@ -56,4 +56,15 @@ describe Lazier::String do
|
|
56
56
|
expect(amp_reference.value).to eq(amp_reference)
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
describe "split_tokens" do
|
61
|
+
it "should return a valid array" do
|
62
|
+
expect(" 1, 2,3,4,,,,,5,5".split_tokens()).to eq(["1", "2", "3", "4", "5", "5"])
|
63
|
+
expect(" 1, 2,3,4,,,,,5,5".split_tokens(false)).to eq(["1", "2", "3", "4", "", "", "", "", "5", "5"])
|
64
|
+
expect(" 1, 2,3,4,,,,,5,5".split_tokens(true, false)).to eq([" 1", "2", "3", "4", "5", "5"])
|
65
|
+
expect(" 1, 2,3,4,,,,,5,5".split_tokens(true, true, true)).to eq(["1", "2", "3", "4", "5"])
|
66
|
+
expect(" 1, 2,3,4,,,,,5,5".split_tokens(true, true, false, "@")).to eq(["1, 2,3,4,,,,,5,5"])
|
67
|
+
expect("1@2@3@4@5".split_tokens(true, true, false, "@")).to eq(["1", "2", "3", "4", "5"])
|
68
|
+
end
|
69
|
+
end
|
59
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|