better_struct 0.2.1 → 0.2.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
  !binary "U0hBMQ==":
3
- metadata.gz: 63739e5a654591d3d685a383a163fca50902f3b2
4
- data.tar.gz: 8ac3510abea38370cbe2d67a951deec7d1c002bd
3
+ metadata.gz: 262cd7ded259c467148ba2682fc571feec48a498
4
+ data.tar.gz: 141737a24c6d7251e08c22ad26c28d222ba12d1f
5
5
  SHA512:
6
- metadata.gz: 45b9c991c3010cfd5ce2b25a853bbffd2f0bef51b6479770571141b8b293b01ceef9ab93102d6054e14a91aae4715b1172768afd37791d0a0d4130d457dc9b76
7
- data.tar.gz: 03f58914d44f74f1d4a2eafb045066b338723f13e603fa32af51f9555aec93ecc1097d1c4aab056d3c7f1803a75807ebc1fef0d3651a10f2fb49661bbb9d0363
6
+ metadata.gz: a52d2c6cdda7576685cc97ba9108121d5b9f8b60f817b8a1f8195614d1adc603ecb0e2b7e13fe60d6fbfc5d73b5848591f1d33feb2054133f8356dac1aed626e
7
+ data.tar.gz: 0038c03c2694d9520e7d8f8749343fbb2179549076607eb3513ba6e66cf7de4896cdacef7ad82db4d7ba5285f906d34706ef6ff510eebdfb8968de561fc243a4
data/lib/better_struct.rb CHANGED
@@ -24,6 +24,10 @@ class BetterStruct
24
24
  value.to_s
25
25
  end
26
26
 
27
+ def empty?
28
+ value.respond_to?(:empty?) ? !!value.empty? : !value
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def wrap(value)
@@ -1,3 +1,3 @@
1
1
  class BetterStruct
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
@@ -33,6 +33,18 @@ module BetterStructTest
33
33
  assert better_struct.to_s == "1"
34
34
  end
35
35
 
36
+ def test_empty
37
+ better_struct = BetterStruct.new([])
38
+
39
+ assert better_struct.empty? == true
40
+ end
41
+
42
+ def test_not_empty
43
+ better_struct = BetterStruct.new(1)
44
+
45
+ assert better_struct.empty? == false
46
+ end
47
+
36
48
  def test_block_argument_wrapping
37
49
  better_struct = BetterStruct.new([3, 2, 1])
38
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-29 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler