cascading-configuration-array 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. data/README.md +369 -0
  2. data/README.rdoc +29 -113
  3. data/lib/cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb +54 -0
  4. data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationSettingsArray → Array}/ClassInstance.rb +5 -3
  5. data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationSettingsArray → Array}/ModuleInstance.rb +7 -4
  6. data/lib/cascading-configuration-array/CascadingConfiguration/Array.rb +33 -0
  7. data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray → CompositingArray}/Instance.rb +4 -2
  8. data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray → CompositingArray}/_private_/Instance.rb +1 -1
  9. data/lib/cascading-configuration-array/CascadingConfiguration/{CascadingCompositeArray.rb → CompositingArray.rb} +3 -3
  10. data/lib/cascading-configuration-array/CascadingConfiguration/{ConfigurationArray.rb → LocalConfigurationArray.rb} +2 -2
  11. data/lib/cascading-configuration-array/CascadingConfiguration/_private_/{CascadingCompositeArray.rb → CompositingArray.rb} +1 -1
  12. data/lib/cascading-configuration-array/CascadingConfiguration/_private_/{ConfigurationArray.rb → LocalConfigurationArray.rb} +1 -1
  13. data/lib/cascading-configuration-array.rb +18 -15
  14. data/spec/CascadingConfiguration/Array/Accessors_spec.rb +28 -0
  15. data/spec/CascadingConfiguration/{ConfigurationSettingsArray_spec.rb → Array_spec.rb} +20 -20
  16. data/spec/CascadingConfiguration/{CascadingCompositeArray_spec.rb → CompositingArray_spec.rb} +89 -89
  17. data/spec/CascadingConfiguration/{ConfigurationArray_spec.rb → LocalConfigurationArray_spec.rb} +12 -12
  18. metadata +18 -17
  19. data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/Accessors.rb +0 -41
  20. data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray.rb +0 -21
  21. data/spec/CascadingConfiguration/ConfigurationSettingsArray/Accessors_spec.rb +0 -28
@@ -1,5 +1,5 @@
1
1
 
2
- class CascadingConfiguration::ConfigurationArray < Array
2
+ class CascadingConfiguration::LocalConfigurationArray < Array
3
3
 
4
4
  attr_accessor :exclude_array
5
5
 
@@ -8,7 +8,7 @@ class CascadingConfiguration::ConfigurationArray < Array
8
8
  ################
9
9
 
10
10
  def initialize()
11
- @exclude_array = Array.new
11
+ @exclude_array = ::Array.new
12
12
  end
13
13
 
14
14
  #########
@@ -1,5 +1,5 @@
1
1
 
2
- class CascadingConfiguration::CascadingCompositeArray < Array
2
+ class CascadingConfiguration::CompositingArray < Array
3
3
 
4
4
  ###########################################################################################################
5
5
  private ###############################################################################################
@@ -1,5 +1,5 @@
1
1
 
2
- class CascadingConfiguration::ConfigurationArray < Array
2
+ class CascadingConfiguration::LocalConfigurationArray < Array
3
3
 
4
4
  ###########################################################################################################
5
5
  private ###############################################################################################
@@ -1,15 +1,18 @@
1
1
 
2
- require 'cascading-configuration-variable'
3
- #require_relative '../../variable/lib/cascading-configuration-variable.rb'
2
+ if $cascading_configuration_development
3
+ require_relative '../../variable/lib/cascading-configuration-variable.rb'
4
+ else
5
+ require 'cascading-configuration-variable'
6
+ end
4
7
 
5
8
  module CascadingConfiguration
6
- class CascadingCompositeArray < Array
9
+ class CompositingArray < Array
7
10
  module Instance
8
11
  end
9
12
  end
10
- class ConfigurationArray < Array
13
+ class LocalConfigurationArray < Array
11
14
  end
12
- module ConfigurationSettingsArray
15
+ module Array
13
16
  module Accessors
14
17
  end
15
18
  module ClassInstance
@@ -21,13 +24,13 @@ module CascadingConfiguration
21
24
  end
22
25
  end
23
26
 
24
- require_relative 'cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray.rb'
25
- require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/CascadingCompositeArray.rb'
26
- require_relative 'cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray/Instance.rb'
27
- require_relative 'cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray/_private_/Instance.rb'
28
- require_relative 'cascading-configuration-array/CascadingConfiguration/ConfigurationArray.rb'
29
- require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/ConfigurationArray.rb'
30
- require_relative 'cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray.rb'
31
- require_relative 'cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/Accessors.rb'
32
- require_relative 'cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/ClassInstance.rb'
33
- require_relative 'cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/ModuleInstance.rb'
27
+ require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray.rb'
28
+ require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb'
29
+ require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb'
30
+ require_relative 'cascading-configuration-array/CascadingConfiguration/CompositingArray/_private_/Instance.rb'
31
+ require_relative 'cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb'
32
+ require_relative 'cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb'
33
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array.rb'
34
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/Accessors.rb'
35
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ClassInstance.rb'
36
+ require_relative 'cascading-configuration-array/CascadingConfiguration/Array/ModuleInstance.rb'
@@ -0,0 +1,28 @@
1
+
2
+ require_relative '../../../lib/cascading-configuration-array.rb'
3
+
4
+ describe CascadingConfiguration::Array::Accessors do
5
+
6
+ ###################################
7
+ # define_cascading_array_setter #
8
+ # define_cascading_array_getter #
9
+ ###################################
10
+
11
+ it 'can define a method to get and modify the configuration array' do
12
+ class CascadingConfiguration::Array::Mock
13
+ include CascadingConfiguration::Variable
14
+ extend CascadingConfiguration::Array::Accessors
15
+ include CascadingConfiguration::Array::ObjectInstance
16
+ extend CascadingConfiguration::Array::ClassInstance
17
+ end
18
+ # setter
19
+ CascadingConfiguration::Array::Mock.define_cascading_array_setter( :some_configuration )
20
+ CascadingConfiguration::Array::Mock.methods.include?( :some_configuration= ).should == true
21
+ CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration= ).should == true
22
+ # getter
23
+ CascadingConfiguration::Array::Mock.define_cascading_array_getter( :some_configuration )
24
+ CascadingConfiguration::Array::Mock.methods.include?( :some_configuration ).should == true
25
+ CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration ).should == true
26
+ end
27
+
28
+ end
@@ -1,7 +1,7 @@
1
1
 
2
2
  require_relative '../../lib/cascading-configuration-array.rb'
3
3
 
4
- describe CascadingConfiguration::ConfigurationSettingsArray do
4
+ describe CascadingConfiguration::Array do
5
5
 
6
6
  ##############################
7
7
  # attr_configuration_array #
@@ -9,65 +9,65 @@ describe CascadingConfiguration::ConfigurationSettingsArray do
9
9
 
10
10
  it 'can define a configuration array, which is the primary interface' do
11
11
 
12
- module CascadingConfiguration::ConfigurationSettingsArray::MockModule
13
- include CascadingConfiguration::ConfigurationSettingsArray
12
+ module CascadingConfiguration::Array::MockModule
13
+ include CascadingConfiguration::Array
14
14
  attr_configuration_array :configuration_setting
15
15
  configuration_setting.should == []
16
16
  configuration_setting.push( :a_configuration )
17
17
  configuration_setting.should == [ :a_configuration ]
18
18
  end
19
19
 
20
- module CascadingConfiguration::ConfigurationSettingsArray::MockModule2
21
- include CascadingConfiguration::ConfigurationSettingsArray::MockModule
20
+ module CascadingConfiguration::Array::MockModule2
21
+ include CascadingConfiguration::Array::MockModule
22
22
  configuration_setting.should == [ :a_configuration ]
23
23
  configuration_setting.push( :another_configuration )
24
24
  configuration_setting.should == [ :a_configuration, :another_configuration ]
25
25
  end
26
26
 
27
- module CascadingConfiguration::ConfigurationSettingsArray::MockModule3
28
- include CascadingConfiguration::ConfigurationSettingsArray::MockModule2
27
+ module CascadingConfiguration::Array::MockModule3
28
+ include CascadingConfiguration::Array::MockModule2
29
29
  configuration_setting.should == [ :a_configuration, :another_configuration ]
30
30
  end
31
31
 
32
- class CascadingConfiguration::ConfigurationSettingsArray::MockClass
33
- include CascadingConfiguration::ConfigurationSettingsArray::MockModule3
32
+ class CascadingConfiguration::Array::MockClass
33
+ include CascadingConfiguration::Array::MockModule3
34
34
  configuration_setting.should == [ :a_configuration, :another_configuration ]
35
35
  configuration_setting.delete( :another_configuration )
36
36
  configuration_setting.should == [ :a_configuration ]
37
37
  end
38
38
 
39
- object_instance_one = CascadingConfiguration::ConfigurationSettingsArray::MockClass.new
39
+ object_instance_one = CascadingConfiguration::Array::MockClass.new
40
40
  object_instance_one.configuration_setting.should == [ :a_configuration ]
41
41
  object_instance_one.configuration_setting.push( :some_other_configuration )
42
42
  object_instance_one.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
43
43
 
44
- class CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1 < CascadingConfiguration::ConfigurationSettingsArray::MockClass
44
+ class CascadingConfiguration::Array::MockClassSub1 < CascadingConfiguration::Array::MockClass
45
45
  configuration_setting.should == [ :a_configuration ]
46
46
  configuration_setting.push( :another_configuration)
47
47
  configuration_setting.should == [ :a_configuration, :another_configuration ]
48
48
  end
49
49
 
50
- object_instance_two = CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1.new
50
+ object_instance_two = CascadingConfiguration::Array::MockClassSub1.new
51
51
  object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration ]
52
52
  object_instance_two.configuration_setting.push( :some_other_configuration )
53
53
  object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
54
54
 
55
55
  # change ancestor setting
56
- CascadingConfiguration::ConfigurationSettingsArray::MockClass.configuration_setting.push( :a_yet_unused_configuration )
57
- CascadingConfiguration::ConfigurationSettingsArray::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration ]
56
+ CascadingConfiguration::Array::MockClass.configuration_setting.push( :a_yet_unused_configuration )
57
+ CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration ]
58
58
  object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
59
- CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
59
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
60
60
  object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
61
61
 
62
62
  # freeze ancestor setting
63
63
  object_instance_one.configuration_setting.freeze!
64
64
  object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
65
- CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1.configuration_setting.freeze!
66
- CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
67
- CascadingConfiguration::ConfigurationSettingsArray::MockClass.configuration_setting.push( :non_cascading_configuration )
68
- CascadingConfiguration::ConfigurationSettingsArray::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :non_cascading_configuration ]
65
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.freeze!
66
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
67
+ CascadingConfiguration::Array::MockClass.configuration_setting.push( :non_cascading_configuration )
68
+ CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :non_cascading_configuration ]
69
69
  object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
70
- CascadingConfiguration::ConfigurationSettingsArray::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
70
+ CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
71
71
  object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
72
72
 
73
73
  end