unity-configuration-container 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +19 -0
- data/README.md +9 -0
- data/Rakefile +4 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/unity/configuration_container/version.rb +7 -0
- data/lib/unity/configuration_container.rb +33 -0
- data/lib/unity-configuration-container.rb +1 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2f37b899e37f018a33dcdd28dc0f66332580ffe3d9b3c2e796f94e5e82a2b5d
|
4
|
+
data.tar.gz: d5d5b2e9da10a7646d941a86e020659ba0fa774cd0575566dc89af7db6e7ac43
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aaf0e7e2b2dafd683cf88daee1c5fbf20662a850d02c3c1705e3563fe56fab7fd9c19e6645e90f4094df1596258a765ad0784659029565770f4e2a93ef70f1e5
|
7
|
+
data.tar.gz: d920ca5437ed29b6c0bd0a516fcd7936f1981f01308b5674994495a8f4037dd21f761339ad8ff325540347cd65929ba0ec5c428b38ed5f1b5050eb55228b4cb8
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
unity-configuration-container (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (13.0.6)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
x86_64-darwin-20
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
rake (~> 13.0)
|
16
|
+
unity-configuration-container!
|
17
|
+
|
18
|
+
BUNDLED WITH
|
19
|
+
2.2.30
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "unity/configuration_container"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "configuration_container/version"
|
4
|
+
|
5
|
+
module Unity
|
6
|
+
module ConfigurationContainer
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
def self.extended(base)
|
10
|
+
base.instance_variable_set(:@configurations_container, {})
|
11
|
+
base.instance_variable_set(:@configurations_container_mutex, Mutex.new)
|
12
|
+
end
|
13
|
+
|
14
|
+
def configurations_container
|
15
|
+
@configurations_container
|
16
|
+
end
|
17
|
+
|
18
|
+
def configuration_for(type, path)
|
19
|
+
config = @configurations_container[path]
|
20
|
+
return config unless config.nil?
|
21
|
+
|
22
|
+
@configurations_container_mutex.synchronize do
|
23
|
+
@configurations_container[path] ||= \
|
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
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'unity/configuration_container'
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unity-configuration-container
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- saluzafa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Thread-safe configuration container
|
14
|
+
email:
|
15
|
+
- julien@pocketsizesun.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- CHANGELOG.md
|
21
|
+
- Gemfile
|
22
|
+
- Gemfile.lock
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- bin/console
|
26
|
+
- bin/setup
|
27
|
+
- lib/unity-configuration-container.rb
|
28
|
+
- lib/unity/configuration_container.rb
|
29
|
+
- lib/unity/configuration_container/version.rb
|
30
|
+
homepage: https://github.com/pocketsizesun/unity-configuration-container
|
31
|
+
licenses: []
|
32
|
+
metadata:
|
33
|
+
allowed_push_host: https://rubygems.org
|
34
|
+
homepage_uri: https://github.com/pocketsizesun/unity-configuration-container
|
35
|
+
source_code_uri: https://github.com/pocketsizesun/unity-configuration-container
|
36
|
+
changelog_uri: https://github.com/pocketsizesun/unity-configuration-container
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.6.0
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubygems_version: 3.2.3
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Configuration Container
|
56
|
+
test_files: []
|