unity-configuration-container 1.0.0 → 1.1.0
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/Gemfile.lock +2 -1
 - data/lib/unity/configuration_container/version.rb +1 -1
 - data/lib/unity/configuration_container.rb +12 -12
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5b8088e80c0b04a599711b76ce5de567b8a2a5afa8ccf349b74d6302f91adef6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a71327d24a339d28f2c80ecd98e4151bc53f35e8ac2237b3ad7def0270cb93e4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 42833f28b908f021ce3b9421842cad1cc93203a4a11796f6ed364f88558a9e639c47b2c143268ad6c807d7523706464d3cd68f4bdd21a766ca6bd093f4d5cd06
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 721907e1323369a63e610921b4662f2557fedea04467c2fdcc9a65105a766be75b614a308c998b43ab4773d143cef421fb1176db8eb4fb267fd1e528b647fe00
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                unity-configuration-container (1. 
     | 
| 
      
 4 
     | 
    
         
            +
                unity-configuration-container (1.1.0)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            GEM
         
     | 
| 
       7 
7 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
         @@ -9,6 +9,7 @@ GEM 
     | 
|
| 
       9 
9 
     | 
    
         
             
                rake (13.0.6)
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
      
 12 
     | 
    
         
            +
              arm64-darwin-21
         
     | 
| 
       12 
13 
     | 
    
         
             
              x86_64-darwin-20
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
         @@ -7,26 +7,26 @@ module Unity 
     | 
|
| 
       7 
7 
     | 
    
         
             
                class Error < StandardError; end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                def self.extended(base)
         
     | 
| 
       10 
     | 
    
         
            -
                  base.instance_variable_set(:@ 
     | 
| 
       11 
     | 
    
         
            -
                  base.instance_variable_set(:@ 
     | 
| 
      
 10 
     | 
    
         
            +
                  base.instance_variable_set(:@unity_configuration_values, {})
         
     | 
| 
      
 11 
     | 
    
         
            +
                  base.instance_variable_set(:@unity_configurations, {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                  base.instance_variable_set(:@unity_configuration_mutex, Mutex.new)
         
     | 
| 
       12 
13 
     | 
    
         
             
                end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
                def configurations_container
         
     | 
| 
       15 
16 
     | 
    
         
             
                  @configurations_container
         
     | 
| 
       16 
17 
     | 
    
         
             
                end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                def  
     | 
| 
       19 
     | 
    
         
            -
                   
     | 
| 
      
 19 
     | 
    
         
            +
                def configuration(name, lazy: false, &block)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @unity_configurations[name] = block
         
     | 
| 
      
 21 
     | 
    
         
            +
                  configuration_for(name) if lazy == false
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def configuration_for(name)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  config = @unity_configuration_values[name]
         
     | 
| 
       20 
26 
     | 
    
         
             
                  return config unless config.nil?
         
     | 
| 
       21 
27 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                  @ 
     | 
| 
       23 
     | 
    
         
            -
                    @ 
     | 
| 
       24 
     | 
    
         
            -
                      case type
         
     | 
| 
       25 
     | 
    
         
            -
                      when :yaml, :yml then YAML.load_file(path)
         
     | 
| 
       26 
     | 
    
         
            -
                      when :json then JSON.load(File.new(path))
         
     | 
| 
       27 
     | 
    
         
            -
                      else
         
     | 
| 
       28 
     | 
    
         
            -
                        raise Error, "File type '#{type}' not supported"
         
     | 
| 
       29 
     | 
    
         
            -
                      end
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @unity_configuration_mutex.synchronize do
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @unity_configuration_values[name] ||= @unity_configurations[name].call
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: unity-configuration-container
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - saluzafa
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-05-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: Thread-safe configuration container
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       49 
49 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       50 
50 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       51 
51 
     | 
    
         
             
            requirements: []
         
     | 
| 
       52 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 52 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
       53 
53 
     | 
    
         
             
            signing_key:
         
     | 
| 
       54 
54 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       55 
55 
     | 
    
         
             
            summary: Configuration Container
         
     |