flipper-active_record 0.24.1 → 0.25.2
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/flipper/adapters/active_record.rb +13 -8
 - data/lib/flipper/version.rb +1 -1
 - data/lib/flipper-active_record.rb +1 -5
 - metadata +9 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8588f6d4f21af0e26bce4808b27ada38e5973425337c694d0a3acf0db2a4f4d3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 140bf33be811acae3f617829d713e2a0965a63c77f1b603ffb5f8cb1a25ce5fe
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 47b3216d5a968322bca0bf8172b2fb5029d58dceba2c27a32acea9ec0ec6fa337fe832c567fbe9206ac219fc891ecf6b8bfb3ffe81fb6ed54ef296c7600e3a99
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5eeae9d707ad211629dd30f06149d25fd0e0f481959e8b53821f4d95cb54a25e2e20dbb0217081264713717863cd2abc7953fb6b8468f5c81038a5b4ee51625f
         
     | 
| 
         @@ -7,21 +7,26 @@ module Flipper 
     | 
|
| 
       7 
7 
     | 
    
         
             
                class ActiveRecord
         
     | 
| 
       8 
8 
     | 
    
         
             
                  include ::Flipper::Adapter
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
                  # Abstract base class for internal models
         
     | 
| 
      
 11 
     | 
    
         
            +
                  class Model < ::ActiveRecord::Base
         
     | 
| 
      
 12 
     | 
    
         
            +
                    self.abstract_class = true
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       10 
15 
     | 
    
         
             
                  # Private: Do not use outside of this adapter.
         
     | 
| 
       11 
     | 
    
         
            -
                  class Feature <  
     | 
| 
      
 16 
     | 
    
         
            +
                  class Feature < Model
         
     | 
| 
       12 
17 
     | 
    
         
             
                    self.table_name = [
         
     | 
| 
       13 
     | 
    
         
            -
                       
     | 
| 
      
 18 
     | 
    
         
            +
                      Model.table_name_prefix,
         
     | 
| 
       14 
19 
     | 
    
         
             
                      "flipper_features",
         
     | 
| 
       15 
     | 
    
         
            -
                       
     | 
| 
      
 20 
     | 
    
         
            +
                      Model.table_name_suffix,
         
     | 
| 
       16 
21 
     | 
    
         
             
                    ].join
         
     | 
| 
       17 
22 
     | 
    
         
             
                  end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
24 
     | 
    
         
             
                  # Private: Do not use outside of this adapter.
         
     | 
| 
       20 
     | 
    
         
            -
                  class Gate <  
     | 
| 
      
 25 
     | 
    
         
            +
                  class Gate < Model
         
     | 
| 
       21 
26 
     | 
    
         
             
                    self.table_name = [
         
     | 
| 
       22 
     | 
    
         
            -
                       
     | 
| 
      
 27 
     | 
    
         
            +
                      Model.table_name_prefix,
         
     | 
| 
       23 
28 
     | 
    
         
             
                      "flipper_gates",
         
     | 
| 
       24 
     | 
    
         
            -
                       
     | 
| 
      
 29 
     | 
    
         
            +
                      Model.table_name_suffix,
         
     | 
| 
       25 
30 
     | 
    
         
             
                    ].join
         
     | 
| 
       26 
31 
     | 
    
         
             
                  end
         
     | 
| 
       27 
32 
     | 
    
         | 
| 
         @@ -106,8 +111,8 @@ module Flipper 
     | 
|
| 
       106 
111 
     | 
    
         
             
                    rows_query = features.join(gates, Arel::Nodes::OuterJoin)
         
     | 
| 
       107 
112 
     | 
    
         
             
                      .on(features[:key].eq(gates[:feature_key]))
         
     | 
| 
       108 
113 
     | 
    
         
             
                      .project(features[:key].as('feature_key'), gates[:key], gates[:value])
         
     | 
| 
       109 
     | 
    
         
            -
                    rows =  
     | 
| 
       110 
     | 
    
         
            -
                    db_gates = rows.map { |row|  
     | 
| 
      
 114 
     | 
    
         
            +
                    rows = @feature_class.connection.select_all rows_query
         
     | 
| 
      
 115 
     | 
    
         
            +
                    db_gates = rows.map { |row| @gate_class.new(row) }
         
     | 
| 
       111 
116 
     | 
    
         
             
                    grouped_db_gates = db_gates.group_by(&:feature_key)
         
     | 
| 
       112 
117 
     | 
    
         
             
                    result = Hash.new { |hash, key| hash[key] = default_config }
         
     | 
| 
       113 
118 
     | 
    
         
             
                    features = grouped_db_gates.keys.map { |key| Flipper::Feature.new(key, self) }
         
     | 
    
        data/lib/flipper/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: flipper-active_record
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.25.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - John Nunemaker
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-08-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: flipper
         
     | 
| 
         @@ -16,14 +16,14 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 0.25.2
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
24 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.25.2
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: activerecord
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -44,7 +44,7 @@ dependencies: 
     | 
|
| 
       44 
44 
     | 
    
         
             
                - - "<"
         
     | 
| 
       45 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       46 
46 
     | 
    
         
             
                    version: '8'
         
     | 
| 
       47 
     | 
    
         
            -
            description: 
     | 
| 
      
 47 
     | 
    
         
            +
            description:
         
     | 
| 
       48 
48 
     | 
    
         
             
            email:
         
     | 
| 
       49 
49 
     | 
    
         
             
            - nunemaker@gmail.com
         
     | 
| 
       50 
50 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -68,7 +68,7 @@ licenses: 
     | 
|
| 
       68 
68 
     | 
    
         
             
            - MIT
         
     | 
| 
       69 
69 
     | 
    
         
             
            metadata:
         
     | 
| 
       70 
70 
     | 
    
         
             
              changelog_uri: https://github.com/jnunemaker/flipper/blob/master/Changelog.md
         
     | 
| 
       71 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 71 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       72 
72 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       73 
73 
     | 
    
         
             
            require_paths:
         
     | 
| 
       74 
74 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -83,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       83 
83 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       84 
84 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       85 
85 
     | 
    
         
             
            requirements: []
         
     | 
| 
       86 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       87 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 86 
     | 
    
         
            +
            rubygems_version: 3.3.7
         
     | 
| 
      
 87 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       88 
88 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       89 
89 
     | 
    
         
             
            summary: ActiveRecord adapter for Flipper
         
     | 
| 
       90 
90 
     | 
    
         
             
            test_files:
         
     |