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 +4 -4
 - data/lib/active_enum/extensions.rb +2 -2
 - data/lib/active_enum/version.rb +1 -1
 - data/spec/active_enum/extensions_spec.rb +5 -0
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5c79754f5d68c12d7955e1a77e870612ffb1fdb62cc65681e50efc137da125ba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e0604ad18f10935d8111491b18481e3b273b7d6d064c0284c41c02836cadff3c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
| 
      
 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
         
     | 
    
        data/lib/active_enum/version.rb
    CHANGED
    
    
| 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-07-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     |