sleeping_king_studios-tools 0.7.0.beta.1 → 0.7.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62b15199f9c5de17132b5e6cd3e47f426385f0da
|
4
|
+
data.tar.gz: a9eb228c33889f8bc4280a33deab36722bc287c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ac337400c83d57d375e53b767daf48f679648def7aa418f38cbec1d919ef6429a7523120ec003961c358279a10362959f815081bc6e414e1c117e4718b86b5
|
7
|
+
data.tar.gz: a0040c5da758d70204c4ddab2012f90e6a7dc568c2d2bd797a267beb6b82079fe24822d403f16c5b6bd2ccff91ecda14821ab634d155362a7c0ce6bd5c44dd77
|
@@ -9,7 +9,14 @@ module SleepingKingStudios::Tools::Toolbox
|
|
9
9
|
|
10
10
|
# Defines a nested namespace for the configuration object.
|
11
11
|
def namespace namespace_name, &block
|
12
|
-
|
12
|
+
namespace =
|
13
|
+
(@namespaces ||= {}).fetch(namespace_name) do
|
14
|
+
@namespaces[namespace_name] = define_namespace namespace_name
|
15
|
+
end # fetch
|
16
|
+
|
17
|
+
namespace.instance_exec namespace, &block if block_given?
|
18
|
+
|
19
|
+
namespace
|
13
20
|
end # method namespace
|
14
21
|
|
15
22
|
# Defines an option for the configuration object.
|
@@ -40,25 +47,28 @@ module SleepingKingStudios::Tools::Toolbox
|
|
40
47
|
end # method option_name=
|
41
48
|
end # method define_mutator
|
42
49
|
|
43
|
-
def define_namespace namespace_name
|
50
|
+
def define_namespace namespace_name
|
44
51
|
namespace =
|
45
52
|
Class.new(SleepingKingStudios::Tools::Toolbox::Configuration)
|
46
|
-
namespace.instance_exec namespace, &block if block_given?
|
47
53
|
|
48
|
-
define_method namespace_name do
|
54
|
+
define_method namespace_name do |&block|
|
49
55
|
if instance_variable_defined?(:"@#{namespace_name}")
|
50
|
-
|
51
|
-
|
56
|
+
config = instance_variable_get(:"@#{namespace_name}")
|
57
|
+
else
|
58
|
+
data = __get_value__(namespace_name, :default => Object.new)
|
59
|
+
config = namespace.new(data)
|
52
60
|
|
53
|
-
|
54
|
-
config = namespace.new(data)
|
61
|
+
config.__root_namespace__ = __root_namespace__ || self
|
55
62
|
|
56
|
-
|
63
|
+
instance_variable_set(:"@#{namespace_name}", config)
|
64
|
+
end # if
|
57
65
|
|
58
|
-
|
66
|
+
block.call(config) if block
|
59
67
|
|
60
68
|
config
|
61
69
|
end # method namespace_name
|
70
|
+
|
71
|
+
namespace
|
62
72
|
end # method define_namespace
|
63
73
|
end # module
|
64
74
|
extend ClassMethods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleeping_king_studios-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.rc.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob "Merlin" Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|