active_enum 1.0.0.rc6 → 1.0.0.rc7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6fb4a88a4e4c0b8894a94b35dee75c23f9ddbdba0db2c5078dd51049cbeb82a
4
- data.tar.gz: 53e5d91603101b6c0e6590ceb58f6c214cbd221be7da6e4780825b51e71b640f
3
+ metadata.gz: 5c79754f5d68c12d7955e1a77e870612ffb1fdb62cc65681e50efc137da125ba
4
+ data.tar.gz: e0604ad18f10935d8111491b18481e3b273b7d6d064c0284c41c02836cadff3c
5
5
  SHA512:
6
- metadata.gz: b208b4ad29373d4f604673eef17315d5ede6265384d0cb3cadda81b674953fa35d09ac8149a2831a257d2f4e05e9931b02c01767aece9b2a7e45e4152f09e462
7
- data.tar.gz: 8ef7bde84f962ac14307dccfee60849d022699c2841fabd7fe33cb5b4c284cafcff938e91497a6f44f02df27fc0cd0d7bbf707162b16663df30ad61d63688f08
6
+ metadata.gz: '07383e22c02937744c155c72e0c35333c03169f7f3807dfd54765f490a225035ecd24017664fe7b1274c134422e164b12d4fc1a18f57b227f649b93bb166c3b2'
7
+ data.tar.gz: 8bd02a86d9a478ec1bf1cbdf76f28fa6d673b00c61f2edddf6a9c3d90782a33986087ff8a3cf789ab439ab58b60227f3f7c36c4ab5ab097ee6b6430bff119119
@@ -110,7 +110,7 @@ module ActiveEnum
110
110
  class_eval <<-DEF
111
111
  def #{attribute}=(arg)
112
112
  if arg.is_a?(Symbol)
113
- super self.class.active_enum_for(:#{attribute})[arg]
113
+ super(self.class.active_enum_for(:#{attribute})[arg])
114
114
  else
115
115
  super
116
116
  end
@@ -127,7 +127,7 @@ module ActiveEnum
127
127
  class_eval <<-DEF
128
128
  def #{attribute}?(arg=nil)
129
129
  if arg
130
- self.#{attribute}(:id) == self.class.active_enum_for(:#{attribute})[arg]
130
+ self.#{attribute}(:id).present? && self.#{attribute}(:id) == self.class.active_enum_for(:#{attribute})[arg]
131
131
  else
132
132
  super()
133
133
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveEnum
2
- VERSION = '1.0.0.rc6'
2
+ VERSION = '1.0.0.rc7'
3
3
  end
@@ -176,6 +176,11 @@ describe ActiveEnum::Extensions do
176
176
  expect(person.sex?(:female)).to be_falsey
177
177
  expect(person.sex?(:Female)).to be_falsey
178
178
  end
179
+
180
+ it 'should return false if attribute is nil regardless of enum value' do
181
+ person.sex = nil
182
+ expect(person.sex?(:nonexistent)).to be_falsey
183
+ end
179
184
  end
180
185
 
181
186
  context "with value as enum name symbol" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc6
4
+ version: 1.0.0.rc7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport