attribute_boolean 1.0.0 → 1.0.1

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: eedf66c547f7dde8c33f9fcc128cfc0030202dca
4
- data.tar.gz: b8977d72b2f447e6bd18f037502405e5aa7cd3c0
3
+ metadata.gz: 2f92342fed6f9922129c9ee58ade914c4fa0336c
4
+ data.tar.gz: e7d5b4b25a1ee1e0b5bacaea0ac18fc7dae65f0c
5
5
  SHA512:
6
- metadata.gz: 196e30138a1793185752dd48c6e12b08352c76fecaf97a078da3aa6454f741a4f755c9ea60c0584b33b06ca6fbaf4c6286ce5e4290ce60677fe40ef9451ccf67
7
- data.tar.gz: 27f42f642ec6eaed4395c70ae98675d2249fbedfc1a0aa667c0a3bdda4949d2edc8be8d5c9f919104e7ee8d6ca5a9b81d80e6fee400c575ec30aedd866714290
6
+ metadata.gz: 10a5c233c4a1241b0ccd289fa2b1b598f01322f3ea5913a41394702582378b7d9187844c28607ce2aa14a26f1a082a2a17fb162e7e258d5e5f19d951222656b0
7
+ data.tar.gz: d8bbd96c0dffaf596e41a83afd1d2afdc5c1ca18c6e6ed678b96523802958b75e727208749a4a15aae6dcdceadf221459d72337d7001b39e38f4a031bb64f00d
@@ -1,6 +1,6 @@
1
1
  module AttributeBoolean
2
2
 
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
 
5
5
  module ClassMethods
6
6
  def attr_boolean(*args)
@@ -40,6 +40,8 @@ module AttributeBoolean
40
40
  end
41
41
  end
42
42
 
43
+ alias_method "#{ name }", "#{ name }?"
44
+
43
45
  define_method("#{ name }=") do |value|
44
46
  is_true =
45
47
  if value == nil
@@ -15,14 +15,16 @@ class AttrBooleanTest < Minitest::Test
15
15
  def test_truthiness
16
16
  [ "y", "yes", true, 1, 2, :y ].each do |value|
17
17
  @obj.field = value
18
- assert_equal true, @obj.field?, "expected #{ value.inspect } to result in true"
18
+ assert_equal true, @obj.field, "expected field #{ value.inspect } to result in true"
19
+ assert_equal true, @obj.field?, "expected field? #{ value.inspect } to result in true"
19
20
  end
20
21
  end
21
22
 
22
23
  def test_falsiness
23
24
  [ false, 0, '0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF', 'n', 'N', 'no', 'NO' ].each do |value|
24
25
  @obj.field = value
25
- assert_equal false, @obj.field?, "expected #{ value.inspect } to result in false"
26
+ assert_equal false, @obj.field, "expected field #{ value.inspect } to result in false"
27
+ assert_equal false, @obj.field?, "expected field? #{ value.inspect } to result in false"
26
28
  end
27
29
  end
28
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribute_boolean
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McHale