lazier 3.4.1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1a1a3a3524603b0027a8ff2a9f871f8ce6af9b6
4
- data.tar.gz: 3e8e7b22a35b18012ce462fe1f68df915181e907
3
+ metadata.gz: 9fd782673a3bf07b5802c5d2f43eca5be8114693
4
+ data.tar.gz: 6e3e2735b5b06c2d483af62c97f47aebc265689a
5
5
  SHA512:
6
- metadata.gz: 26caf1b2f2fd5f208b9f56009f51dfabeb2ab5e567e1fb684ba5c0b8af1a65f9bc50334870983bf4ef4d7662b76b6130444070fa0d0bc53101d8fef4b99b26ab
7
- data.tar.gz: 809083ed17cd447a29eab774e559a1c8ffaeb4e28babf5eeda1fec13cfc985652e1b8f98738dd0c113c791b5edc6af620295a98390441be33331814651b9abb1
6
+ metadata.gz: 41a1f28f6506279ef86b64b2f6b06c49d4eaf61e86d5249820132e9c7a936f68fa074041f19e9e891d4550aa51315cffcbf53897d0045ffde906e2253f560342
7
+ data.tar.gz: ff8c536ec2471c36d1dca8f9d05e8e5fb1ab98a8034632ba168963fd33bbab1c82bab8b0490c3bfa09769c69f75a1ae2fb28d4d4297aa468a533d91f8e8586c0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 3.4.2 / 2014-01-29
2
+
3
+ * `Lazier::Object#ensure_array` returns `[]` for `nil` when no default_value is specified.
4
+
1
5
  ### 3.4.1 / 2014-01-27
2
6
 
3
7
  * Fixed return value for `Lazier::Hash#enable_dotted_access`.
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 Mon Jan 27 12:18:41 2014 by
1169
+ Generated on Wed Jan 29 16:33:02 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>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Mon Jan 27 12:18:41 2014 by
291
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:42 2014 by
389
+ Generated on Wed Jan 29 16:33:03 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>
@@ -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 Mon Jan 27 12:18:41 2014 by
724
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:41 2014 by
1545
+ Generated on Wed Jan 29 16:33:03 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>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Mon Jan 27 12:18:41 2014 by
119
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:42 2014 by
127
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:42 2014 by
241
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:41 2014 by
546
+ Generated on Wed Jan 29 16:33:02 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 Mon Jan 27 12:18:41 2014 by
1073
+ Generated on Wed Jan 29 16:33:02 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>
@@ -536,7 +536,7 @@
536
536
  </div>
537
537
 
538
538
  <div id="footer">
539
- Generated on Mon Jan 27 12:18:42 2014 by
539
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:41 2014 by
124
+ Generated on Wed Jan 29 16:33:02 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 Mon Jan 27 12:18:41 2014 by
324
+ Generated on Wed Jan 29 16:33:02 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>
@@ -834,7 +834,7 @@
834
834
  <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 91</span>
835
835
 
836
836
  <span class='kw'>def</span> <span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='kw'>nil</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_compact'>compact</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
837
- <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span><span class='rparen'>)</span>
837
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>NilClass</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
838
838
  <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_manipulate_array'>manipulate_array</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span> <span class='op'>||</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>||</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span>
839
839
  <span class='id identifier rubyid_manipulate_array'>manipulate_array</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span>
840
840
  <span class='kw'>end</span></pre>
@@ -1931,7 +1931,7 @@
1931
1931
 
1932
1932
  <li>
1933
1933
 
1934
- <span class='name'>&amp;block</span>
1934
+ <span class='name'>block</span>
1935
1935
 
1936
1936
 
1937
1937
  <span class='type'>(<tt>Proc</tt>)</span>
@@ -2203,7 +2203,7 @@
2203
2203
  </div>
2204
2204
 
2205
2205
  <div id="footer">
2206
- Generated on Mon Jan 27 12:18:41 2014 by
2206
+ Generated on Wed Jan 29 16:33:02 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>
@@ -213,7 +213,7 @@ Pathname.new("/usr/bin/ruby").components
213
213
  </div>
214
214
 
215
215
  <div id="footer">
216
- Generated on Mon Jan 27 12:18:41 2014 by
216
+ Generated on Wed Jan 29 16:33:03 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>
@@ -2405,7 +2405,7 @@
2405
2405
  </div>
2406
2406
 
2407
2407
  <div id="footer">
2408
- Generated on Mon Jan 27 12:18:42 2014 by
2408
+ Generated on Wed Jan 29 16:33:03 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>
@@ -563,7 +563,7 @@
563
563
  </div>
564
564
 
565
565
  <div id="footer">
566
- Generated on Mon Jan 27 12:18:41 2014 by
566
+ Generated on Wed Jan 29 16:33:02 2014 by
567
567
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
568
568
  0.8.7.3 (ruby-2.1.0).
569
569
  </div>
@@ -1663,7 +1663,7 @@
1663
1663
  </div>
1664
1664
 
1665
1665
  <div id="footer">
1666
- Generated on Mon Jan 27 12:18:41 2014 by
1666
+ Generated on Wed Jan 29 16:33:03 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 &amp; Canad
1015
1015
  </div>
1016
1016
 
1017
1017
  <div id="footer">
1018
- Generated on Mon Jan 27 12:18:41 2014 by
1018
+ Generated on Wed Jan 29 16:33:03 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>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>1</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>2</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 Mon Jan 27 12:18:41 2014 by
183
+ Generated on Wed Jan 29 16:33:03 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 Mon Jan 27 12:18:40 2014 by
336
+ Generated on Wed Jan 29 16:33:02 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 Mon Jan 27 12:18:41 2014 by
109
+ Generated on Wed Jan 29 16:33:02 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 Mon Jan 27 12:18:41 2014 by
109
+ Generated on Wed Jan 29 16:33:02 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>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Mon Jan 27 12:18:41 2014 by
106
+ Generated on Wed Jan 29 16:33:02 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/object.rb CHANGED
@@ -54,7 +54,7 @@ module Lazier
54
54
  #
55
55
  # @param method [Symbol] The method to send.
56
56
  # @param args [Array] The arguments to send.
57
- # @param &block [Proc] The block to pass to the method.
57
+ # @param block [Proc] The block to pass to the method.
58
58
  # @return [Object|nil] The return value of the method or `nil`, if the object does not respond to the method.
59
59
  def safe_send(method, *args, &block)
60
60
  respond_to?(method) ? send(method, *args, &block) : nil
@@ -89,7 +89,7 @@ module Lazier
89
89
  # @param block [Proc] A block to sanitize entries. It must accept the value as unique argument.
90
90
  # @return [Array] If the object is an array, then the object itself, a single element array containing the object otherwise.
91
91
  def ensure_array(default_value = nil, uniq = false, compact = false, flatten = false, sanitizer = nil, &block)
92
- rv = is_a?(::Array) ? dup : (default_value || [self])
92
+ rv = is_a?(::Array) ? dup : (default_value || (self.is_a?(NilClass) ? [] : [self]))
93
93
  rv = manipulate_array(rv, uniq, compact, flatten).map(&(block || sanitizer)) if block_given? || sanitizer
94
94
  manipulate_array(rv, uniq, compact, flatten)
95
95
  end
@@ -16,7 +16,7 @@ module Lazier
16
16
  MINOR = 4
17
17
 
18
18
  # The patch version.
19
- PATCH = 1
19
+ PATCH = 2
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -130,7 +130,7 @@ describe Lazier::Object do
130
130
  describe "#ensure_string" do
131
131
  it "should correctly handle strings" do
132
132
  expect(" abc ".ensure_string).to eq(" abc ")
133
- 1.ensure_string == "1"
133
+ expect(1.ensure_string).to eq("1")
134
134
  expect(1.0.ensure_string).to eq("1.0")
135
135
  expect(:abc.ensure_string).to eq("abc")
136
136
  expect(nil.ensure_string).to eq("")
@@ -148,7 +148,7 @@ describe Lazier::Object do
148
148
 
149
149
  describe "#ensure_array" do
150
150
  it "should convert to an array with the object it self or a default value" do
151
- expect(nil.ensure_array).to eq([nil])
151
+ expect(nil.ensure_array).to eq([])
152
152
  expect("A".ensure_array).to eq(["A"])
153
153
  expect({a: "b"}.ensure_array).to eq([{a: "b"}])
154
154
  expect(nil.ensure_array(["1"])).to eq(["1"])
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.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json