cascading-configuration-array 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +138 -0
- data/lib/cascading-configuration-array.rb +33 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray.rb +215 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray/Instance.rb +37 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray/_private_/Instance.rb +16 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationArray.rb +166 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray.rb +21 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/Accessors.rb +41 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/ClassInstance.rb +17 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/ConfigurationSettingsArray/ModuleInstance.rb +20 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/CascadingCompositeArray.rb +57 -0
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/ConfigurationArray.rb +26 -0
- data/spec/CascadingConfiguration/CascadingCompositeArray_spec.rb +519 -0
- data/spec/CascadingConfiguration/ConfigurationArray_spec.rb +155 -0
- data/spec/CascadingConfiguration/ConfigurationSettingsArray/Accessors_spec.rb +28 -0
- data/spec/CascadingConfiguration/ConfigurationSettingsArray_spec.rb +75 -0
- metadata +91 -0
data/README.rdoc
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
== Cascading Configuration
|
2
|
+
|
3
|
+
http://rubygems.org/gems/cascading-configuration-array
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Adds methods for cascading configuration arrays. Support package for cascading-configuration.
|
8
|
+
|
9
|
+
== SUMMARY:
|
10
|
+
|
11
|
+
* :attr_configuration_array
|
12
|
+
|
13
|
+
== INSTALL:
|
14
|
+
|
15
|
+
* sudo gem install cascading-configuration-array
|
16
|
+
|
17
|
+
== EXAMPLE:
|
18
|
+
|
19
|
+
#############################################################################
|
20
|
+
######################## attr_configuration_array ###########################
|
21
|
+
#############################################################################
|
22
|
+
|
23
|
+
##################
|
24
|
+
# first module #
|
25
|
+
##################
|
26
|
+
|
27
|
+
module CascadingConfiguration::MockModule
|
28
|
+
attr_configuration_array :some_array_configuration
|
29
|
+
self.some_array_configuration = [ :some_value ]
|
30
|
+
# => some_array_configuration.should == [ :some_value ]
|
31
|
+
end
|
32
|
+
|
33
|
+
########################
|
34
|
+
# including module 1 #
|
35
|
+
########################
|
36
|
+
|
37
|
+
module CascadingConfiguration::MockModule2
|
38
|
+
# => some_array_configuration.should == [ :some_value ]
|
39
|
+
self.some_array_configuration = [ :module_value ]
|
40
|
+
# => some_array_configuration.should == [ :module_value ]
|
41
|
+
end
|
42
|
+
|
43
|
+
########################
|
44
|
+
# including module 2 #
|
45
|
+
########################
|
46
|
+
|
47
|
+
module CascadingConfiguration::MockModule3
|
48
|
+
# => some_array_configuration.should == [ :module_value ]
|
49
|
+
end
|
50
|
+
|
51
|
+
###############
|
52
|
+
# top class #
|
53
|
+
###############
|
54
|
+
|
55
|
+
class CascadingConfiguration::MockClass
|
56
|
+
# => some_array_configuration.should == [ :module_value ]
|
57
|
+
self.some_array_configuration = [ :another_value ]
|
58
|
+
# => some_array_configuration.should == [ :another_value ]
|
59
|
+
end
|
60
|
+
|
61
|
+
###########################
|
62
|
+
# instance of top class #
|
63
|
+
###########################
|
64
|
+
|
65
|
+
object_instance_one = CascadingConfiguration::MockClass.new
|
66
|
+
# => object_instance_one.some_array_configuration.should == [ :another_value ]
|
67
|
+
object_instance_one.some_array_configuration = [ :yet_another_value ]
|
68
|
+
# => object_instance_one.some_array_configuration.should == [ :yet_another_value ]
|
69
|
+
# => CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
70
|
+
# => CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
71
|
+
|
72
|
+
############################
|
73
|
+
# first inheriting class #
|
74
|
+
############################
|
75
|
+
|
76
|
+
class CascadingConfiguration::MockClassSub1 < CascadingConfiguration::MockClass
|
77
|
+
# => some_array_configuration.should == [ :another_value ]
|
78
|
+
self.some_array_configuration = [ :a_value_not_yet_used ]
|
79
|
+
# => some_array_configuration.should == [ :a_value_not_yet_used ]
|
80
|
+
# => CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
81
|
+
# => CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
82
|
+
end
|
83
|
+
|
84
|
+
########################################
|
85
|
+
# instance of first inheriting class #
|
86
|
+
########################################
|
87
|
+
|
88
|
+
object_instance_two = CascadingConfiguration::MockClassSub1.new
|
89
|
+
# => object_instance_two.some_array_configuration.should == [ :a_value_not_yet_used ]
|
90
|
+
# => object_instance_one.some_array_configuration.should == [ :yet_another_value ]
|
91
|
+
# => CascadingConfiguration::MockClass.some_array_configuration.should == [ :another_value ]
|
92
|
+
# => CascadingConfiguration::MockModule.some_array_configuration.should == [ :some_value ]
|
93
|
+
|
94
|
+
#############################
|
95
|
+
# second inheriting class #
|
96
|
+
#############################
|
97
|
+
|
98
|
+
class CascadingConfiguration::MockClassSub2 < CascadingConfiguration::MockClassSub1
|
99
|
+
# => some_array_configuration.should == [ :a_value_not_yet_used ]
|
100
|
+
self.some_array_configuration = [ :another_value_not_yet_used ]
|
101
|
+
# => some_array_configuration.should == [ :another_value_not_yet_used ]
|
102
|
+
end
|
103
|
+
|
104
|
+
#########################################
|
105
|
+
# instance of second inheriting class #
|
106
|
+
#########################################
|
107
|
+
|
108
|
+
object_instance_three = CascadingConfiguration::MockClassSub2.new
|
109
|
+
# => object_instance_three.some_array_configuration.should == [ :another_value_not_yet_used ]
|
110
|
+
object_instance_three.some_array_configuration = [ :one_more_unused_value ]
|
111
|
+
# => object_instance_three.some_array_configuration.should == [ :one_more_unused_value ]
|
112
|
+
|
113
|
+
#############################################################################
|
114
|
+
|
115
|
+
== LICENSE:
|
116
|
+
|
117
|
+
(The MIT License)
|
118
|
+
|
119
|
+
Copyright (c) 2011 Asher
|
120
|
+
|
121
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
122
|
+
a copy of this software and associated documentation files (the
|
123
|
+
'Software'), to deal in the Software without restriction, including
|
124
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
125
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
126
|
+
permit persons to whom the Software is furnished to do so, subject to
|
127
|
+
the following conditions:
|
128
|
+
|
129
|
+
The above copyright notice and this permission notice shall be
|
130
|
+
included in all copies or substantial portions of the Software.
|
131
|
+
|
132
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
133
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
134
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
135
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
136
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
137
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
138
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
require 'cascading-configuration-variable'
|
3
|
+
#require_relative '../../variable/lib/cascading-configuration-variable.rb'
|
4
|
+
|
5
|
+
module CascadingConfiguration
|
6
|
+
class CascadingCompositeArray < Array
|
7
|
+
module Instance
|
8
|
+
end
|
9
|
+
end
|
10
|
+
class ConfigurationArray < Array
|
11
|
+
end
|
12
|
+
module ConfigurationSettingsArray
|
13
|
+
module Accessors
|
14
|
+
end
|
15
|
+
module ClassInstance
|
16
|
+
end
|
17
|
+
module ObjectInstance
|
18
|
+
end
|
19
|
+
module ModuleInstance
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
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'
|
@@ -0,0 +1,215 @@
|
|
1
|
+
|
2
|
+
class CascadingConfiguration::CascadingCompositeArray < Array
|
3
|
+
|
4
|
+
attr_accessor :working_instance, :local_cascading_array
|
5
|
+
|
6
|
+
################
|
7
|
+
# initialize #
|
8
|
+
################
|
9
|
+
|
10
|
+
def initialize( cascading_name, working_instance )
|
11
|
+
@cascading_name = cascading_name
|
12
|
+
@cascading_variable = working_instance.cascading_variable_name( @cascading_name )
|
13
|
+
@working_instance = working_instance
|
14
|
+
# if first ancestor can have a composite array, register self with it in case it gets updated in the future
|
15
|
+
if ( first_ancestor = @working_instance.first_ancestor ).respond_to?( :composite_array_for_cascading_configuration )
|
16
|
+
@parent_composite_array = first_ancestor.composite_array_for_cascading_configuration( @cascading_name )
|
17
|
+
@parent_composite_array.register_child_composite_array( self )
|
18
|
+
end
|
19
|
+
# get local cascading array (not included in parent composite)
|
20
|
+
@local_cascading_array = ::CascadingConfiguration::ConfigurationArray.new
|
21
|
+
# we may later have our own child composites
|
22
|
+
@child_composite_arrays = Array.new
|
23
|
+
# initialize self status for parent and local
|
24
|
+
update_self_as_cascading_composite
|
25
|
+
end
|
26
|
+
|
27
|
+
####################################
|
28
|
+
# register_child_composite_array #
|
29
|
+
####################################
|
30
|
+
|
31
|
+
def register_child_composite_array( child_composite_array )
|
32
|
+
@child_composite_arrays.push( child_composite_array )
|
33
|
+
return self
|
34
|
+
end
|
35
|
+
|
36
|
+
######################################
|
37
|
+
# unregister_child_composite_array #
|
38
|
+
######################################
|
39
|
+
|
40
|
+
def unregister_child_composite_array( child_composite_array )
|
41
|
+
@child_composite_arrays.delete( child_composite_array )
|
42
|
+
return self
|
43
|
+
end
|
44
|
+
|
45
|
+
#########
|
46
|
+
# []= #
|
47
|
+
#########
|
48
|
+
|
49
|
+
def []=( index, element )
|
50
|
+
# we sort internally, so index is irrelevant
|
51
|
+
# no reason to differentiate from push
|
52
|
+
push( element )
|
53
|
+
end
|
54
|
+
|
55
|
+
########
|
56
|
+
# << #
|
57
|
+
########
|
58
|
+
|
59
|
+
def <<( *elements )
|
60
|
+
# no reason to differentiate from push
|
61
|
+
push( *elements )
|
62
|
+
end
|
63
|
+
|
64
|
+
#######
|
65
|
+
# + #
|
66
|
+
#######
|
67
|
+
|
68
|
+
def +( *arrays )
|
69
|
+
# no reason to differentiate from push
|
70
|
+
arrays.each do |this_array|
|
71
|
+
push( *this_array )
|
72
|
+
end
|
73
|
+
return self
|
74
|
+
end
|
75
|
+
|
76
|
+
############
|
77
|
+
# concat #
|
78
|
+
############
|
79
|
+
|
80
|
+
def concat( *arrays )
|
81
|
+
arrays.each do |this_array|
|
82
|
+
push( *this_array )
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
##########
|
87
|
+
# push #
|
88
|
+
##########
|
89
|
+
|
90
|
+
alias_method :super_push, :push
|
91
|
+
def push( *elements )
|
92
|
+
|
93
|
+
# we are a composite array
|
94
|
+
# that means we have to set the value for our class
|
95
|
+
@local_cascading_array.push( *elements )
|
96
|
+
|
97
|
+
update_adding_composite_elements( *elements )
|
98
|
+
|
99
|
+
return self
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
#######
|
104
|
+
# - #
|
105
|
+
#######
|
106
|
+
|
107
|
+
def -( *arrays )
|
108
|
+
|
109
|
+
arrays.each do |this_array|
|
110
|
+
delete( *this_array )
|
111
|
+
end
|
112
|
+
|
113
|
+
return self
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
############
|
118
|
+
# delete #
|
119
|
+
############
|
120
|
+
|
121
|
+
alias_method :super_delete, :delete
|
122
|
+
def delete( *elements )
|
123
|
+
|
124
|
+
@local_cascading_array.delete( *elements )
|
125
|
+
|
126
|
+
update_removing_composite_elements( *elements )
|
127
|
+
|
128
|
+
return self
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
#########
|
133
|
+
# pop #
|
134
|
+
#########
|
135
|
+
|
136
|
+
def pop
|
137
|
+
|
138
|
+
element = super
|
139
|
+
|
140
|
+
@local_cascading_array.delete( element )
|
141
|
+
|
142
|
+
update_removing_composite_elements( element )
|
143
|
+
|
144
|
+
return element
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
###########
|
149
|
+
# shift #
|
150
|
+
###########
|
151
|
+
|
152
|
+
def shift
|
153
|
+
|
154
|
+
element = super
|
155
|
+
|
156
|
+
@local_cascading_array.delete( element )
|
157
|
+
|
158
|
+
update_removing_composite_elements( element )
|
159
|
+
|
160
|
+
return element
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
############
|
165
|
+
# slice! #
|
166
|
+
############
|
167
|
+
|
168
|
+
def slice!( *args )
|
169
|
+
|
170
|
+
elements = super
|
171
|
+
|
172
|
+
@local_cascading_array.delete( *elements )
|
173
|
+
|
174
|
+
update_removing_composite_elements( *elements )
|
175
|
+
|
176
|
+
return elements
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
###########
|
181
|
+
# clear #
|
182
|
+
###########
|
183
|
+
|
184
|
+
alias_method :super_clear, :clear
|
185
|
+
def clear
|
186
|
+
|
187
|
+
# add all existing values to exclude array
|
188
|
+
@local_cascading_array.delete( *self )
|
189
|
+
|
190
|
+
update_removing_composite_elements( *self )
|
191
|
+
|
192
|
+
return self
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
#############
|
197
|
+
# freeze! #
|
198
|
+
#############
|
199
|
+
|
200
|
+
# freezes configuration and prevents ancestors from changing this configuration in the future
|
201
|
+
def freeze!
|
202
|
+
|
203
|
+
# move current configuration into local configuration
|
204
|
+
@local_cascading_array.clear
|
205
|
+
@local_cascading_array.exclude_array.clear
|
206
|
+
@local_cascading_array.push( *self )
|
207
|
+
|
208
|
+
# unregister with parent composite so we don't get future updates from it
|
209
|
+
@parent_composite_array.unregister_child_composite_array( self ) if @parent_composite_array
|
210
|
+
|
211
|
+
return self
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
data/lib/cascading-configuration-array/CascadingConfiguration/CascadingCompositeArray/Instance.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
module CascadingConfiguration::CascadingCompositeArray::Instance
|
3
|
+
|
4
|
+
###################
|
5
|
+
# self.included #
|
6
|
+
###################
|
7
|
+
|
8
|
+
def self.included( class_or_module )
|
9
|
+
module_self = self
|
10
|
+
class_or_module.instance_eval do
|
11
|
+
extend module_self
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#################################################
|
16
|
+
# composite_array_for_cascading_configuration #
|
17
|
+
#################################################
|
18
|
+
|
19
|
+
def composite_array_for_cascading_configuration( cascading_name )
|
20
|
+
|
21
|
+
# initialize composite array if necessary or acquire it from object
|
22
|
+
composite_array_variable = composite_array_variable_name( cascading_name )
|
23
|
+
|
24
|
+
composite_array = nil
|
25
|
+
|
26
|
+
if instance_variable_defined?( composite_array_variable )
|
27
|
+
composite_array = instance_variable_get( composite_array_variable )
|
28
|
+
else
|
29
|
+
composite_array = ::CascadingConfiguration::CascadingCompositeArray.new( cascading_name, self )
|
30
|
+
instance_variable_set( composite_array_variable, composite_array )
|
31
|
+
end
|
32
|
+
|
33
|
+
return composite_array
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
module CascadingConfiguration::CascadingCompositeArray::Instance
|
3
|
+
|
4
|
+
###########################################################################################################
|
5
|
+
private ###############################################################################################
|
6
|
+
###########################################################################################################
|
7
|
+
|
8
|
+
###################################
|
9
|
+
# composite_array_variable_name #
|
10
|
+
###################################
|
11
|
+
|
12
|
+
def composite_array_variable_name( configuration_name )
|
13
|
+
return ( cascading_variable_name( configuration_name ).to_s + '__' + 'composite_array' ).to_sym
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
|
2
|
+
class CascadingConfiguration::ConfigurationArray < Array
|
3
|
+
|
4
|
+
attr_accessor :exclude_array
|
5
|
+
|
6
|
+
################
|
7
|
+
# initialize #
|
8
|
+
################
|
9
|
+
|
10
|
+
def initialize()
|
11
|
+
@exclude_array = Array.new
|
12
|
+
end
|
13
|
+
|
14
|
+
#########
|
15
|
+
# []= #
|
16
|
+
#########
|
17
|
+
|
18
|
+
def []=( index, element )
|
19
|
+
# we sort internally, so index is irrelevant
|
20
|
+
# no reason to differentiate from push
|
21
|
+
push( element )
|
22
|
+
end
|
23
|
+
|
24
|
+
########
|
25
|
+
# << #
|
26
|
+
########
|
27
|
+
|
28
|
+
def <<( *elements )
|
29
|
+
# no reason to differentiate from push
|
30
|
+
push( *elements )
|
31
|
+
end
|
32
|
+
|
33
|
+
#######
|
34
|
+
# + #
|
35
|
+
#######
|
36
|
+
|
37
|
+
def +( *element_arrays )
|
38
|
+
element_arrays.each do |this_element_array|
|
39
|
+
push( *this_element_array )
|
40
|
+
end
|
41
|
+
return self
|
42
|
+
end
|
43
|
+
|
44
|
+
##########
|
45
|
+
# push #
|
46
|
+
##########
|
47
|
+
|
48
|
+
def push( *elements )
|
49
|
+
|
50
|
+
# add elements to configuration array
|
51
|
+
super
|
52
|
+
|
53
|
+
# sort and uniq self
|
54
|
+
sort!.uniq!
|
55
|
+
|
56
|
+
# make sure we don't still have any elements noted as excluded at this level
|
57
|
+
remove_from_exclude_array( *elements )
|
58
|
+
|
59
|
+
return self
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
############
|
64
|
+
# concat #
|
65
|
+
############
|
66
|
+
|
67
|
+
def concat( *arrays )
|
68
|
+
|
69
|
+
arrays.each do |this_array|
|
70
|
+
push( *this_array )
|
71
|
+
end
|
72
|
+
|
73
|
+
return self
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
#######
|
78
|
+
# - #
|
79
|
+
#######
|
80
|
+
|
81
|
+
def -( *arrays )
|
82
|
+
|
83
|
+
arrays.each do |this_array|
|
84
|
+
delete( *this_array )
|
85
|
+
end
|
86
|
+
|
87
|
+
return self
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
############
|
92
|
+
# delete #
|
93
|
+
############
|
94
|
+
|
95
|
+
def delete( *elements )
|
96
|
+
|
97
|
+
elements.each do |this_element|
|
98
|
+
super( this_element )
|
99
|
+
end
|
100
|
+
# add subtracted elements to exclude array
|
101
|
+
add_to_exclude_array( *elements )
|
102
|
+
|
103
|
+
return self
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
#########
|
108
|
+
# pop #
|
109
|
+
#########
|
110
|
+
|
111
|
+
def pop
|
112
|
+
|
113
|
+
element = super
|
114
|
+
|
115
|
+
# add popped element to exclude array
|
116
|
+
add_to_exclude_array( element )
|
117
|
+
|
118
|
+
return element
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
###########
|
123
|
+
# shift #
|
124
|
+
###########
|
125
|
+
|
126
|
+
def shift
|
127
|
+
|
128
|
+
element = super
|
129
|
+
|
130
|
+
# add shifted element to exclude array
|
131
|
+
add_to_exclude_array( element )
|
132
|
+
|
133
|
+
return element
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
############
|
138
|
+
# slice! #
|
139
|
+
############
|
140
|
+
|
141
|
+
def slice!( *args )
|
142
|
+
|
143
|
+
elements = super
|
144
|
+
|
145
|
+
# add sliced elements to exclude array
|
146
|
+
delete( *elements )
|
147
|
+
|
148
|
+
return elements
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
###########
|
153
|
+
# clear #
|
154
|
+
###########
|
155
|
+
|
156
|
+
def clear
|
157
|
+
|
158
|
+
# add all existing values to exclude array
|
159
|
+
delete( *self )
|
160
|
+
|
161
|
+
# clear existing values
|
162
|
+
super
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|