cascading-configuration-hash 1.6.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cascading-configuration-hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-03 00:00:00.000000000 Z
12
+ date: 2012-02-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: module-cluster
16
- requirement: &70173537181800 !ruby/object:Gem::Requirement
16
+ requirement: &70242260848920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70173537181800
24
+ version_requirements: *70242260848920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cascading-configuration-variable
27
- requirement: &70173537180500 !ruby/object:Gem::Requirement
27
+ requirement: &70242257466580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,19 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70173537180500
35
+ version_requirements: *70242257466580
36
36
  description: Provides :attr_configuration_hash.
37
37
  email: asher@ridiculouspower.com
38
38
  executables: []
39
39
  extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
- - lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash/LocalConfigurationHash.rb
43
42
  - lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/CompositingHash.rb
44
43
  - lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/Interface/GettersSetters.rb
45
44
  - lib/cascading-configuration-hash/_private_/CascadingConfiguration/Hash/ModuleSupportMethods.rb
46
45
  - lib/cascading-configuration-hash/CascadingConfiguration/Hash/Interface.rb
47
46
  - lib/cascading-configuration-hash/CascadingConfiguration/Hash.rb
48
47
  - lib/cascading-configuration-hash.rb
49
- - spec/_private_/CascadingConfiguration/Hash/CompositingHash/LocalConfigurationHash_spec.rb
50
48
  - spec/_private_/CascadingConfiguration/Hash/CompositingHash_spec.rb
51
49
  - spec/CascadingConfiguration/Hash_spec.rb
52
50
  - README.md
@@ -1,110 +0,0 @@
1
-
2
- class CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash < Hash
3
-
4
- attr_accessor :exclude_array
5
-
6
- ################
7
- # initialize #
8
- ################
9
-
10
- def initialize()
11
- @exclude_array = [ ]
12
- end
13
-
14
- #########
15
- # []= #
16
- #########
17
-
18
- def []=( key, value )
19
- super
20
- remove_from_exclude_array( key )
21
- end
22
-
23
- ###########
24
- # store #
25
- ###########
26
-
27
- def store( key, value )
28
- self[ key ] = value
29
- end
30
-
31
- ############
32
- # delete #
33
- ############
34
-
35
- def delete( key )
36
- value = super
37
- add_to_exclude_array( key )
38
- return value
39
- end
40
-
41
- ############
42
- # merge! #
43
- ############
44
-
45
- def merge!( other_hash )
46
- super
47
- remove_from_exclude_array( *other_hash.keys )
48
- return self
49
- end
50
-
51
- #############
52
- # replace #
53
- #############
54
-
55
- def replace( other_hash )
56
- add_to_exclude_array( *self.keys )
57
- super
58
- end
59
-
60
- ###########
61
- # shift #
62
- ###########
63
-
64
- def shift
65
- element = super
66
- add_to_exclude_array( element )
67
- return element
68
- end
69
-
70
- ###########
71
- # clear #
72
- ###########
73
-
74
- def clear
75
- # add all existing values to exclude array
76
- self.each do |this_key, this_value|
77
- delete( this_key )
78
- end
79
- # clear existing values
80
- super
81
- end
82
-
83
- ###########################################################################################################
84
- private ###############################################################################################
85
- ###########################################################################################################
86
-
87
- ##########################
88
- # add_to_exclude_array #
89
- ##########################
90
-
91
- def add_to_exclude_array( *elements )
92
- @exclude_array ||= [ ]
93
- @exclude_array += elements
94
- @exclude_array.sort!.uniq!
95
- end
96
-
97
- ###############################
98
- # remove_from_exclude_array #
99
- ###############################
100
-
101
- def remove_from_exclude_array( *elements )
102
- if @exclude_array
103
- @exclude_array -= elements
104
- @exclude_array.sort!.uniq!
105
- else
106
- @exclude_array ||= [ ]
107
- end
108
- end
109
-
110
- end
@@ -1,95 +0,0 @@
1
-
2
- require_relative '../../../../../lib/cascading-configuration-hash.rb'
3
-
4
- describe CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash do
5
-
6
- #########
7
- # []= #
8
- #########
9
-
10
- it 'can add elements' do
11
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
12
- hash_instance[ :some_setting ] = :some_value
13
- hash_instance.should == { :some_setting => :some_value }
14
- hash_instance.exclude_array.include?( :some_setting ).should == false
15
- hash_instance[ :other_setting ] = :some_value
16
- hash_instance.should == { :some_setting => :some_value,
17
- :other_setting => :some_value }
18
- hash_instance.exclude_array.include?( :other_setting ).should == false
19
- end
20
-
21
- ###########
22
- # store #
23
- ###########
24
-
25
- it 'can add elements' do
26
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
27
- hash_instance.store( :some_setting, :some_value )
28
- hash_instance.should == { :some_setting => :some_value }
29
- hash_instance.exclude_array.include?( :some_setting ).should == false
30
- hash_instance.store( :other_setting, :some_value )
31
- hash_instance.should == { :some_setting => :some_value,
32
- :other_setting => :some_value }
33
- hash_instance.exclude_array.include?( :other_setting ).should == false
34
- end
35
-
36
- ############
37
- # delete #
38
- ############
39
-
40
- it 'can exclude elements' do
41
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
42
- hash_instance[ :some_setting ] = :some_value
43
- hash_instance.delete( :some_setting ).should == :some_value
44
- hash_instance.should == {}
45
- hash_instance.exclude_array.include?( :some_setting ).should == true
46
- end
47
-
48
- ############
49
- # merge! #
50
- ############
51
-
52
- it 'can merge from another hash' do
53
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
54
- hash_instance.merge!( { :some_setting => :some_value } )
55
- hash_instance.should == { :some_setting => :some_value }
56
- end
57
-
58
- #############
59
- # replace #
60
- #############
61
-
62
- it 'can replace existing elements with others' do
63
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
64
- hash_instance.merge!( { :some_setting => :some_value } )
65
- hash_instance.should == { :some_setting => :some_value }
66
- hash_instance.replace( { :other_setting => :some_value } )
67
- hash_instance.should == { :other_setting => :some_value }
68
- hash_instance.exclude_array.include?( :other_setting ).should == false
69
- hash_instance.exclude_array.include?( :some_setting ).should == true
70
- end
71
-
72
- ###########
73
- # shift #
74
- ###########
75
-
76
- it 'can shift the first element' do
77
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
78
- hash_instance.merge!( { :some_setting => :some_value } )
79
- hash_instance.shift.should == [ :some_setting, :some_value ]
80
- hash_instance.should == {}
81
- end
82
-
83
- ###########
84
- # clear #
85
- ###########
86
-
87
- it 'can clear, causing present elements to be excluded' do
88
- hash_instance = ::CascadingConfiguration::Hash::CompositingHash::LocalConfigurationHash.new
89
- hash_instance.merge!( { :some_setting => :some_value } )
90
- hash_instance.clear
91
- hash_instance.should == {}
92
- hash_instance.exclude_array.include?( :some_setting ).should == true
93
- end
94
-
95
- end