cascading-configuration-hash 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,6 @@ end
27
27
  require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash.rb'
28
28
  require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/CompositingHash.rb'
29
29
  require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash/Instance.rb'
30
- require_relative 'cascading-configuration-hash/CascadingConfiguration/CompositingHash/_private_/Instance.rb'
31
30
  require_relative 'cascading-configuration-hash/CascadingConfiguration/LocalConfigurationHash.rb'
32
31
  require_relative 'cascading-configuration-hash/CascadingConfiguration/_private_/LocalConfigurationHash.rb'
33
32
  require_relative 'cascading-configuration-hash/CascadingConfiguration/Hash.rb'
@@ -18,18 +18,20 @@ module CascadingConfiguration::CompositingHash::Instance
18
18
  # composite_hash_for_cascading_configuration #
19
19
  ################################################
20
20
 
21
- def composite_hash_for_cascading_configuration( configuration_name )
21
+ def composite_hash_for_cascading_configuration( cascading_name )
22
22
 
23
- # initialize composite hash if necessary or acquire it from object
24
- composite_hash_variable = composite_hash_variable_name( configuration_name )
25
23
  composite_hash = nil
26
- if instance_variable_defined?( composite_hash_variable )
27
- composite_hash = instance_variable_get( composite_hash_variable )
28
- else
29
- composite_hash = ::CascadingConfiguration::CompositingHash.new( configuration_name, self )
30
- instance_variable_set( composite_hash_variable, composite_hash )
31
- end
32
-
24
+
25
+ klass = ( is_a?( Module ) ? self : self.class )
26
+ accessor_support_module = klass::AccessorSupportModule
27
+ self_instance = self
28
+ accessor_support_module.instance_eval do
29
+ unless composite_hash = ( ( @composite_hashes ||= Hash.new )[ cascading_name ] ||= Hash.new )[ self_instance ]
30
+ composite_hash = ::CascadingConfiguration::CompositingHash.new( cascading_name, self_instance )
31
+ @composite_hashes[ cascading_name ][ self_instance ] = composite_hash
32
+ end
33
+ end
34
+
33
35
  return composite_hash
34
36
 
35
37
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 1
9
- version: 1.1.1
8
+ - 2
9
+ version: 1.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Asher
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-15 00:00:00 -04:00
17
+ date: 2011-07-16 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,7 +41,6 @@ extra_rdoc_files: []
41
41
  files:
42
42
  - lib/cascading-configuration-hash/CascadingConfiguration/_private_/CompositingHash.rb
43
43
  - lib/cascading-configuration-hash/CascadingConfiguration/_private_/LocalConfigurationHash.rb
44
- - lib/cascading-configuration-hash/CascadingConfiguration/CompositingHash/_private_/Instance.rb
45
44
  - lib/cascading-configuration-hash/CascadingConfiguration/CompositingHash/Instance.rb
46
45
  - lib/cascading-configuration-hash/CascadingConfiguration/CompositingHash.rb
47
46
  - lib/cascading-configuration-hash/CascadingConfiguration/Hash/Accessors.rb
@@ -52,8 +51,8 @@ files:
52
51
  - lib/cascading-configuration-hash.rb
53
52
  - spec/CascadingConfiguration/CascadingCompositeHash_spec.rb
54
53
  - spec/CascadingConfiguration/ConfigurationHash_spec.rb
55
- - spec/CascadingConfiguration/ConfigurationSettingsHash/Accessors_spec.rb
56
- - spec/CascadingConfiguration/ConfigurationSettingsHash_spec.rb
54
+ - spec/CascadingConfiguration/Hash/Accessors_spec.rb
55
+ - spec/CascadingConfiguration/Hash_spec.rb
57
56
  - README.md
58
57
  - README.rdoc
59
58
  has_rdoc: true
@@ -1,17 +0,0 @@
1
-
2
- module CascadingConfiguration::CompositingHash::Instance
3
-
4
- ###########################################################################################################
5
- private ###############################################################################################
6
- ###########################################################################################################
7
-
8
- ##################################
9
- # composite_hash_variable_name #
10
- ##################################
11
-
12
- def composite_hash_variable_name( configuration_name )
13
- klass = ( is_a?( Module ) ? self : self.class )
14
- return ( klass::AccessorSupportModule.cascading_variable_name( configuration_name ).to_s + '__' + 'composite_hash' ).to_sym
15
- end
16
-
17
- end