cascading-configuration-hash 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -233,30 +233,6 @@ module SomeModule
233
233
  end
234
234
  ```
235
235
 
236
- ### Hidden Configuration ###
237
-
238
- #### :attr_hide ####
239
-
240
- Coming soon.
241
-
242
- ```ruby
243
- module SomeModule
244
-
245
- include CascadingConfiguration
246
-
247
- attr_configuration :some_array_setting
248
-
249
- instance_variables.include?( :@some_array_setting ) # => true
250
-
251
- attr_hide :some_array_setting
252
-
253
- instance_variables.include?( :@some_array_setting ) # => false
254
-
255
- end
256
- ```
257
-
258
- Causes configuration variable to be stored in external context so that it is not included in instance variables.
259
-
260
236
  # License #
261
237
 
262
238
  (The MIT License)
@@ -10,7 +10,6 @@ class CascadingConfiguration::CompositingHash < Hash
10
10
  def initialize( cascading_name, working_instance )
11
11
  @cascading_name = cascading_name
12
12
  @working_class = ( working_instance.is_a?( Module ) ? working_instance : working_instance.class )
13
- @cascading_variable = @working_class.accessor_module_support.cascading_variable_name( @cascading_name )
14
13
  @working_instance = working_instance
15
14
  # if first ancestor can have a composite array, register self with it in case it gets updated in the future
16
15
  if ( first_ancestor = @working_instance.first_ancestor ).respond_to?( :composite_hash_for_cascading_configuration )
@@ -35,6 +35,7 @@ module CascadingConfiguration::Hash
35
35
  extend module_self
36
36
  extend module_self::Interface
37
37
  extend module_self::AccessorDefinitionMethods
38
+ extend CascadingConfiguration::Variable::Interface
38
39
  extend CascadingConfiguration::Hash::ModuleInclusionExtensionSupport unless is_a?( Class )
39
40
  end
40
41
  end
@@ -48,6 +49,7 @@ module CascadingConfiguration::Hash
48
49
  class_or_module.instance_eval do
49
50
  extend module_self::Interface
50
51
  extend module_self::AccessorDefinitionMethods
52
+ extend CascadingConfiguration::Variable::Interface
51
53
  end
52
54
  end
53
55
 
@@ -31,28 +31,33 @@ describe CascadingConfiguration::Hash do
31
31
  self.configuration_setting[ :a_configuration ] = :some_value
32
32
  configuration_setting.should == { :a_configuration => :some_value }
33
33
  instance_methods.include?( :configuration_setting ).should == false
34
+ instance_variables.empty?.should == true
34
35
  # => including modules and classes get nothing
35
36
  module SubmoduleIncluding
36
37
  include CascadingConfiguration::Hash::ConfigurationMockModuleExtended
37
38
  instance_methods.include?( :configuration_setting ).should == false
38
39
  respond_to?( :configuration_setting ).should == false
40
+ instance_variables.empty?.should == true
39
41
  end
40
42
  # => extending modules and classes get nothing
41
43
  module SubmoduleExtending
42
44
  extend CascadingConfiguration::Hash::ConfigurationMockModuleExtended
43
45
  instance_methods.include?( :configuration_setting ).should == false
44
46
  respond_to?( :configuration_setting ).should == false
47
+ instance_variables.empty?.should == true
45
48
  end
46
49
  # => instances of including and extending classes get nothing
47
50
  class ClassIncluding
48
51
  include CascadingConfiguration::Hash::ConfigurationMockModuleExtended
49
52
  instance_methods.include?( :configuration_setting ).should == false
50
53
  respond_to?( :configuration_setting ).should == false
54
+ instance_variables.empty?.should == true
51
55
  end
52
56
  class ClassExtending
53
57
  extend CascadingConfiguration::Hash::ConfigurationMockModuleExtended
54
58
  instance_methods.include?( :configuration_setting ).should == false
55
59
  respond_to?( :configuration_setting ).should == false
60
+ instance_variables.empty?.should == true
56
61
  end
57
62
  end
58
63
 
@@ -67,6 +72,7 @@ describe CascadingConfiguration::Hash do
67
72
  self.configuration_setting[ :a_configuration ] = :some_value
68
73
  configuration_setting.should == { :a_configuration => :some_value }
69
74
  instance_methods.include?( :configuration_setting ).should == true
75
+ instance_variables.empty?.should == true
70
76
  # => including modules and classes get attr_configuration and configurations
71
77
  module SubmoduleIncluding
72
78
  include CascadingConfiguration::Hash::ConfigurationMockModuleIncluded
@@ -78,6 +84,7 @@ describe CascadingConfiguration::Hash do
78
84
  :other_setting => :some_value }
79
85
  configuration_setting.delete( :other_setting ).should == :some_value
80
86
  configuration_setting.should == { :a_configuration => :some_value }
87
+ instance_variables.empty?.should == true
81
88
  end
82
89
  # => extending modules and classes get attr_configuration and configurations
83
90
  module SubmoduleExtending
@@ -93,6 +100,7 @@ describe CascadingConfiguration::Hash do
93
100
  configuration_setting.delete( :other_setting ).should == :some_value
94
101
  configuration_setting.should == { :a_configuration => :some_value }
95
102
  instance_methods.include?( :configuration_setting ).should == false
103
+ instance_variables.empty?.should == true
96
104
  end
97
105
  # => instances of including classes get configurations
98
106
  class ClassIncluding
@@ -105,11 +113,13 @@ describe CascadingConfiguration::Hash do
105
113
  :other_setting => :some_value }
106
114
  configuration_setting.delete( :other_setting ).should == :some_value
107
115
  configuration_setting.should == { :a_configuration => :some_value }
116
+ instance_variables.empty?.should == true
108
117
  end
109
118
  setting_class_including_instance = ClassIncluding.new
110
119
  setting_class_including_instance.respond_to?( :configuration_setting ).should == true
111
120
  setting_class_including_instance.configuration_setting.should == { :a_configuration => :some_value }
112
121
  setting_class_including_instance.configuration_setting.delete( :a_configuration )
122
+ setting_class_including_instance.instance_variables.empty?.should == true
113
123
  class ClassExtending
114
124
  extend CascadingConfiguration::Hash::ConfigurationMockModuleIncluded
115
125
  respond_to?( :configuration_setting ).should == true
@@ -119,9 +129,11 @@ describe CascadingConfiguration::Hash do
119
129
  :other_setting => :some_value }
120
130
  configuration_setting.delete( :other_setting ).should == :some_value
121
131
  configuration_setting.should == { :a_configuration => :some_value }
132
+ instance_variables.empty?.should == true
122
133
  end
123
134
  setting_class_including_instance = ClassExtending.new
124
135
  setting_class_including_instance.respond_to?( :configuration_setting ).should == false
136
+ setting_class_including_instance.instance_variables.empty?.should == true
125
137
  end
126
138
 
127
139
  class CascadingConfiguration::Hash::ConfigurationMockClass
@@ -132,6 +144,7 @@ describe CascadingConfiguration::Hash do
132
144
  :other_setting => :some_value }
133
145
  configuration_setting.delete( :other_setting ).should == :some_value
134
146
  configuration_setting.should == { :a_configuration => :some_value }
147
+ instance_variables.empty?.should == true
135
148
  end
136
149
 
137
150
  object_instance_one = CascadingConfiguration::Hash::ConfigurationMockClass.new
@@ -139,12 +152,14 @@ describe CascadingConfiguration::Hash do
139
152
  object_instance_one.configuration_setting[ :some_other_configuration ] = :some_value
140
153
  object_instance_one.configuration_setting.should == { :a_configuration => :some_value,
141
154
  :some_other_configuration => :some_value }
155
+ object_instance_one.instance_variables.empty?.should == true
142
156
 
143
157
  class CascadingConfiguration::Hash::ConfigurationMockClassSub1 < CascadingConfiguration::Hash::ConfigurationMockClass
144
158
  configuration_setting.should == { :a_configuration => :some_value }
145
159
  self.configuration_setting[ :another_configuration ] = :some_value
146
160
  configuration_setting.should == { :a_configuration => :some_value,
147
161
  :another_configuration => :some_value }
162
+ instance_variables.empty?.should == true
148
163
  end
149
164
 
150
165
  object_instance_two = CascadingConfiguration::Hash::ConfigurationMockClassSub1.new
@@ -154,6 +169,7 @@ describe CascadingConfiguration::Hash do
154
169
  object_instance_two.configuration_setting.should == { :a_configuration => :some_value,
155
170
  :another_configuration => :some_value,
156
171
  :some_other_configuration => :some_value }
172
+ object_instance_two.instance_variables.empty?.should == true
157
173
 
158
174
  # change ancestor setting
159
175
  CascadingConfiguration::Hash::ConfigurationMockClass.configuration_setting[ :a_yet_unused_configuration ] = :some_value
@@ -249,28 +265,33 @@ describe CascadingConfiguration::Hash do
249
265
  self.configuration_setting[ :a_configuration ] = :some_value
250
266
  configuration_setting.should == { :a_configuration => :some_value }
251
267
  instance_methods.include?( :configuration_setting ).should == false
268
+ instance_variables.empty?.should == true
252
269
  # => including modules and classes get nothing
253
270
  module SubmoduleIncluding
254
271
  include CascadingConfiguration::Hash::ClassConfigurationMockModuleExtended
255
272
  instance_methods.include?( :configuration_setting ).should == false
256
273
  respond_to?( :configuration_setting ).should == false
274
+ instance_variables.empty?.should == true
257
275
  end
258
276
  # => extending modules and classes get nothing
259
277
  module SubmoduleExtending
260
278
  extend CascadingConfiguration::Hash::ClassConfigurationMockModuleExtended
261
279
  instance_methods.include?( :configuration_setting ).should == false
262
280
  respond_to?( :configuration_setting ).should == false
281
+ instance_variables.empty?.should == true
263
282
  end
264
283
  # => instances of including and extending classes get nothing
265
284
  class ClassIncluding
266
285
  include CascadingConfiguration::Hash::ClassConfigurationMockModuleExtended
267
286
  instance_methods.include?( :configuration_setting ).should == false
268
287
  respond_to?( :configuration_setting ).should == false
288
+ instance_variables.empty?.should == true
269
289
  end
270
290
  class ClassExtending
271
291
  extend CascadingConfiguration::Hash::ClassConfigurationMockModuleExtended
272
292
  instance_methods.include?( :configuration_setting ).should == false
273
293
  respond_to?( :configuration_setting ).should == false
294
+ instance_variables.empty?.should == true
274
295
  end
275
296
  end
276
297
 
@@ -285,6 +306,7 @@ describe CascadingConfiguration::Hash do
285
306
  self.configuration_setting[ :a_configuration ] = :some_value
286
307
  configuration_setting.should == { :a_configuration => :some_value }
287
308
  instance_methods.include?( :configuration_setting ).should == false
309
+ instance_variables.empty?.should == true
288
310
  # => including modules and classes get attr_configuration and configurations
289
311
  module SubmoduleIncluding
290
312
  include CascadingConfiguration::Hash::ClassConfigurationMockModuleIncluded
@@ -296,6 +318,7 @@ describe CascadingConfiguration::Hash do
296
318
  :other_setting => :some_value }
297
319
  configuration_setting.delete( :other_setting ).should == :some_value
298
320
  configuration_setting.should == { :a_configuration => :some_value }
321
+ instance_variables.empty?.should == true
299
322
  end
300
323
  # => extending modules and classes get attr_configuration and configurations
301
324
  module SubmoduleExtending
@@ -311,6 +334,7 @@ describe CascadingConfiguration::Hash do
311
334
  configuration_setting.delete( :other_setting ).should == :some_value
312
335
  configuration_setting.should == { :a_configuration => :some_value }
313
336
  instance_methods.include?( :configuration_setting ).should == false
337
+ instance_variables.empty?.should == true
314
338
  end
315
339
  # => instances of including classes get configurations
316
340
  class ClassIncluding
@@ -323,9 +347,11 @@ describe CascadingConfiguration::Hash do
323
347
  :other_setting => :some_value }
324
348
  configuration_setting.delete( :other_setting ).should == :some_value
325
349
  configuration_setting.should == { :a_configuration => :some_value }
350
+ instance_variables.empty?.should == true
326
351
  end
327
352
  setting_class_including_instance = ClassIncluding.new
328
353
  setting_class_including_instance.respond_to?( :configuration_setting ).should == false
354
+ setting_class_including_instance.instance_variables.empty?.should == true
329
355
  class ClassExtending
330
356
  extend CascadingConfiguration::Hash::ClassConfigurationMockModuleIncluded
331
357
  respond_to?( :configuration_setting ).should == true
@@ -336,9 +362,11 @@ describe CascadingConfiguration::Hash do
336
362
  :other_setting => :some_value }
337
363
  configuration_setting.delete( :other_setting ).should == :some_value
338
364
  configuration_setting.should == { :a_configuration => :some_value }
365
+ instance_variables.empty?.should == true
339
366
  end
340
367
  setting_class_including_instance = ClassExtending.new
341
368
  setting_class_including_instance.respond_to?( :configuration_setting ).should == false
369
+ setting_class_including_instance.instance_variables.empty?.should == true
342
370
  end
343
371
 
344
372
  class CascadingConfiguration::Hash::ClassConfigurationMockClass
@@ -351,10 +379,12 @@ describe CascadingConfiguration::Hash do
351
379
  :other_setting => :some_value }
352
380
  configuration_setting.delete( :other_setting ).should == :some_value
353
381
  configuration_setting.should == { :a_configuration => :some_value }
382
+ instance_variables.empty?.should == true
354
383
  end
355
384
 
356
385
  object_instance_one = CascadingConfiguration::Hash::ClassConfigurationMockClass.new
357
386
  object_instance_one.respond_to?( :a_configuration ).should == false
387
+ object_instance_one.instance_variables.empty?.should == true
358
388
 
359
389
  class CascadingConfiguration::Hash::ClassConfigurationMockClassSub1 < CascadingConfiguration::Hash::ClassConfigurationMockClass
360
390
  respond_to?( :configuration_setting ).should == true
@@ -363,6 +393,7 @@ describe CascadingConfiguration::Hash do
363
393
  self.configuration_setting[ :another_configuration ] = :some_value
364
394
  configuration_setting.should == { :a_configuration => :some_value,
365
395
  :another_configuration => :some_value }
396
+ instance_variables.empty?.should == true
366
397
  end
367
398
 
368
399
  object_instance_two = CascadingConfiguration::Hash::ClassConfigurationMockClassSub1.new
@@ -442,28 +473,33 @@ describe CascadingConfiguration::Hash do
442
473
  self.configuration_setting[ :a_configuration ] = :some_value
443
474
  configuration_setting.should == { :a_configuration => :some_value }
444
475
  instance_methods.include?( :configuration_setting ).should == false
476
+ instance_variables.empty?.should == true
445
477
  # => including modules and classes get nothing
446
478
  module SubmoduleIncluding
447
479
  include CascadingConfiguration::Hash::LocalConfigurationMockModuleExtended
448
480
  instance_methods.include?( :configuration_setting ).should == false
449
481
  respond_to?( :configuration_setting ).should == false
482
+ instance_variables.empty?.should == true
450
483
  end
451
484
  # => extending modules and classes get nothing
452
485
  module SubmoduleExtending
453
486
  extend CascadingConfiguration::Hash::LocalConfigurationMockModuleExtended
454
487
  instance_methods.include?( :configuration_setting ).should == false
455
488
  respond_to?( :configuration_setting ).should == false
489
+ instance_variables.empty?.should == true
456
490
  end
457
491
  # => instances of including and extending classes get nothing
458
492
  class ClassIncluding
459
493
  include CascadingConfiguration::Hash::LocalConfigurationMockModuleExtended
460
494
  instance_methods.include?( :configuration_setting ).should == false
461
495
  respond_to?( :configuration_setting ).should == false
496
+ instance_variables.empty?.should == true
462
497
  end
463
498
  class ClassExtending
464
499
  extend CascadingConfiguration::Hash::LocalConfigurationMockModuleExtended
465
500
  instance_methods.include?( :configuration_setting ).should == false
466
501
  respond_to?( :configuration_setting ).should == false
502
+ instance_variables.empty?.should == true
467
503
  end
468
504
  end
469
505
 
@@ -478,11 +514,13 @@ describe CascadingConfiguration::Hash do
478
514
  self.configuration_setting[ :a_configuration ] = :some_value
479
515
  configuration_setting.should == { :a_configuration => :some_value }
480
516
  instance_methods.include?( :configuration_setting ).should == false
517
+ instance_variables.empty?.should == true
481
518
  # => including modules and classes get attr_configuration and configurations
482
519
  module SubmoduleIncluding
483
520
  include CascadingConfiguration::Hash::LocalConfigurationMockModuleIncluded
484
521
  instance_methods.include?( :configuration_setting ).should == false
485
522
  respond_to?( :configuration_setting ).should == false
523
+ instance_variables.empty?.should == true
486
524
  end
487
525
  # => extending modules and classes get attr_configuration and configurations
488
526
  module SubmoduleExtending
@@ -492,40 +530,49 @@ describe CascadingConfiguration::Hash do
492
530
  # - the rest of the ancestors will be the extending module's include chain
493
531
  instance_methods.include?( :configuration_setting ).should == false
494
532
  respond_to?( :configuration_setting ).should == false
533
+ instance_variables.empty?.should == true
495
534
  end
496
535
  # => instances of including classes get configurations
497
536
  class ClassIncluding
498
537
  include CascadingConfiguration::Hash::LocalConfigurationMockModuleIncluded
499
538
  instance_methods.include?( :configuration_setting ).should == false
500
539
  respond_to?( :configuration_setting ).should == false
540
+ instance_variables.empty?.should == true
501
541
  end
502
542
  setting_class_including_instance = ClassIncluding.new
503
543
  setting_class_including_instance.respond_to?( :configuration_setting ).should == false
544
+ setting_class_including_instance.instance_variables.empty?.should == true
504
545
  class ClassExtending
505
546
  extend CascadingConfiguration::Hash::LocalConfigurationMockModuleIncluded
506
547
  instance_methods.include?( :configuration_setting ).should == false
507
548
  respond_to?( :configuration_setting ).should == false
549
+ instance_variables.empty?.should == true
508
550
  end
509
551
  setting_class_including_instance = ClassExtending.new
510
552
  setting_class_including_instance.respond_to?( :configuration_setting ).should == false
553
+ setting_class_including_instance.instance_variables.empty?.should == true
511
554
  end
512
555
 
513
556
  class CascadingConfiguration::Hash::LocalConfigurationMockClass
514
557
  include CascadingConfiguration::Hash::LocalConfigurationMockModuleIncluded::SubmoduleIncluding
515
558
  instance_methods.include?( :configuration_setting ).should == false
516
559
  respond_to?( :configuration_setting ).should == false
560
+ instance_variables.empty?.should == true
517
561
  end
518
562
 
519
563
  object_instance_one = CascadingConfiguration::Hash::LocalConfigurationMockClass.new
520
564
  object_instance_one.respond_to?( :a_configuration ).should == false
565
+ object_instance_one.instance_variables.empty?.should == true
521
566
 
522
567
  class CascadingConfiguration::Hash::LocalConfigurationMockClassSub1 < CascadingConfiguration::Hash::LocalConfigurationMockClass
523
568
  instance_methods.include?( :configuration_setting ).should == false
524
569
  respond_to?( :configuration_setting ).should == false
570
+ instance_variables.empty?.should == true
525
571
  end
526
572
 
527
573
  object_instance_two = CascadingConfiguration::Hash::LocalConfigurationMockClassSub1.new
528
574
  object_instance_two.respond_to?( :a_configuration ).should == false
575
+ object_instance_two.instance_variables.empty?.should == true
529
576
 
530
577
  end
531
578
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 1
9
- version: 1.2.1
8
+ - 2
9
+ version: 1.2.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-19 00:00:00 -04:00
17
+ date: 2011-07-20 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency