operator_recordable 0.1.0 → 0.1.1
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/CHANGELOG.md +7 -0
 - data/README.md +1 -0
 - data/lib/operator_recordable/configuration.rb +2 -2
 - data/lib/operator_recordable/store.rb +2 -6
 - data/lib/operator_recordable/version.rb +1 -1
 - data/lib/operator_recordable.rb +8 -2
 - 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: 9439bc5b4ce5623c61b5d9c4f4ad0d9da08fdec39f7bfdb19000d8e622dc2ce0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 27c6348566975088b2a1b43523a41d1a7e4997c1152794ab9e9c8a7ba378f335
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4cef8201a40b1e628177f249ae8f0978a42d8e78c18ab43cef3e9d159cb14e3e7dd9ba230c75d54ed3576c45ede68d086900a580f53a4a508a281360b85d89e2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 775227886773bb67f8f57fb08b403f50b84c2bbb63077273cb0825e160e0fdd8f3cb990987a925cd09f74210bc8f71dbe69b71b288946f49e9a31856043ab9aa
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # OperatorRecordable
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            [](https://badge.fury.io/rb/operator_recordable)
         
     | 
| 
       3 
4 
     | 
    
         
             
            [](https://travis-ci.org/yujideveloper/operator_recordable)
         
     | 
| 
       4 
5 
     | 
    
         
             
            [](https://codeclimate.com/github/yujideveloper/operator_recordable/maintainability)
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
         @@ -8,7 +8,7 @@ module OperatorRecordable 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                def initialize(config)
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @config = initialize_config(config)
         
     | 
| 
       11 
     | 
    
         
            -
                  initialize_store
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @store = initialize_store
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                %i[operator_class_name creator_column_name updater_column_name deleter_column_name
         
     | 
| 
         @@ -37,7 +37,7 @@ module OperatorRecordable 
     | 
|
| 
       37 
37 
     | 
    
         
             
                def initialize_store
         
     | 
| 
       38 
38 
     | 
    
         
             
                  args = [*config[:store]]
         
     | 
| 
       39 
39 
     | 
    
         
             
                  name = args.shift
         
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
      
 40 
     | 
    
         
            +
                  Store.fetch(name).new(*args)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                class Model
         
     | 
| 
         @@ -1,17 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module OperatorRecordable
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                def self.operator_store_key
         
     | 
| 
       6 
     | 
    
         
            -
                  :operator_recordable_operator
         
     | 
| 
       7 
     | 
    
         
            -
                end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              module Store
         
     | 
| 
       9 
5 
     | 
    
         
             
                def self.register(name, klass)
         
     | 
| 
       10 
6 
     | 
    
         
             
                  @stores ||= {}
         
     | 
| 
       11 
7 
     | 
    
         
             
                  @stores[name] = klass
         
     | 
| 
       12 
8 
     | 
    
         
             
                end
         
     | 
| 
       13 
9 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                def self. 
     | 
| 
      
 10 
     | 
    
         
            +
                def self.fetch(name)
         
     | 
| 
       15 
11 
     | 
    
         
             
                  @stores.fetch(name)
         
     | 
| 
       16 
12 
     | 
    
         
             
                end
         
     | 
| 
       17 
13 
     | 
    
         
             
              end
         
     | 
    
        data/lib/operator_recordable.rb
    CHANGED
    
    | 
         @@ -16,14 +16,20 @@ module OperatorRecordable 
     | 
|
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              def self.operator
         
     | 
| 
       19 
     | 
    
         
            -
                config.store[ 
     | 
| 
      
 19 
     | 
    
         
            +
                config.store[operator_store_key]
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              def self.operator=(operator)
         
     | 
| 
       23 
     | 
    
         
            -
                config.store[ 
     | 
| 
      
 23 
     | 
    
         
            +
                config.store[operator_store_key] = operator
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              def self.included(class_or_module)
         
     | 
| 
       27 
27 
     | 
    
         
             
                class_or_module.extend Recorder.new(config)
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
              private_class_method :included
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def self.operator_store_key
         
     | 
| 
      
 32 
     | 
    
         
            +
                :operator_recordable_operator
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
              private_class_method :operator_store_key
         
     | 
| 
       29 
35 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: operator_recordable
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Yuji Hanamura
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-09-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activerecord
         
     |