hash-compositing 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # CompositingHash #
1
+ # Hash::Compositing #
2
2
 
3
3
  http://rubygems.org/gems/hash-compositing
4
4
 
5
5
  # Description #
6
6
 
7
- Provides CompositingHash.
7
+ Provides Hash::Compositing.
8
8
 
9
9
  # Summary #
10
10
 
@@ -17,8 +17,8 @@ An implementation of Hash that permits chaining, where children inherit changes
17
17
  # Usage #
18
18
 
19
19
  ```ruby
20
- compositing_hash = CompositingHash.new
21
- sub_compositing_hash = CompositingHash.new( compositing_hash )
20
+ compositing_hash = Hash::Compositing.new
21
+ sub_compositing_hash = Hash::Compositing.new( compositing_hash )
22
22
 
23
23
  compositing_hash[ :some_key ] = :some_value
24
24
  # compositing_hash
@@ -1,5 +1,5 @@
1
1
 
2
- module ::CompositingHash::HashInterface
2
+ module ::Hash::Compositing::HashInterface
3
3
 
4
4
  ##########################
5
5
  # self.append_features #
@@ -7,8 +7,8 @@ require_relative './namespaces'
7
7
  # source file requires
8
8
  require_relative './requires.rb'
9
9
 
10
- class ::CompositingHash < ::HookedHash
10
+ class ::Hash::Compositing < ::HookedHash
11
11
 
12
- include ::CompositingHash::HashInterface
12
+ include ::Hash::Compositing::HashInterface
13
13
 
14
14
  end
@@ -1,3 +1,3 @@
1
1
 
2
- class ::CompositingHash < ::HookedHash
2
+ class ::Hash::Compositing < ::HookedHash
3
3
  end
@@ -1,20 +1,20 @@
1
1
 
2
2
  require_relative '../../lib/hash-compositing.rb'
3
3
 
4
- describe ::CompositingHash do
4
+ describe ::Hash::Compositing do
5
5
 
6
6
  before :all do
7
7
 
8
- module ::CompositingHash::MockA
8
+ module ::Hash::Compositing::MockA
9
9
  # needed for ccv ancestor determination
10
10
  def self.some_configuration
11
11
  end
12
12
  end
13
- module ::CompositingHash::MockB
13
+ module ::Hash::Compositing::MockB
14
14
  end
15
15
 
16
- @configuration_instance = ::CompositingHash::MockA
17
- @sub_configuration_instance = ::CompositingHash::MockB
16
+ @configuration_instance = ::Hash::Compositing::MockA
17
+ @sub_configuration_instance = ::Hash::Compositing::MockB
18
18
 
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ describe ::CompositingHash do
24
24
 
25
25
  it 'can add initialize with an ancestor, inheriting its values and linking to it as a child' do
26
26
 
27
- cascading_composite_hash = ::CompositingHash.new
27
+ cascading_composite_hash = ::Hash::Compositing.new
28
28
 
29
29
  cascading_composite_hash.instance_variable_get( :@parent_composite_object ).should == nil
30
30
  cascading_composite_hash.should == {}
@@ -37,7 +37,7 @@ describe ::CompositingHash do
37
37
  :C => 3,
38
38
  :D => 4 }
39
39
 
40
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
40
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
41
41
  sub_cascading_composite_hash.instance_variable_get( :@parent_composite_object ).should == cascading_composite_hash
42
42
  sub_cascading_composite_hash.should == { :A => 1,
43
43
  :B => 2,
@@ -56,9 +56,9 @@ describe ::CompositingHash do
56
56
 
57
57
  it 'can update for a parent store' do
58
58
 
59
- cascading_composite_hash = ::CompositingHash.new
59
+ cascading_composite_hash = ::Hash::Compositing.new
60
60
  cascading_composite_hash[ :A ] = 1
61
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
61
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
62
62
 
63
63
  sub_cascading_composite_hash.instance_eval do
64
64
  update_as_sub_hash_for_parent_store( :A )
@@ -73,8 +73,8 @@ describe ::CompositingHash do
73
73
 
74
74
  it 'can update for a parent delete' do
75
75
 
76
- cascading_composite_hash = ::CompositingHash.new
77
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
76
+ cascading_composite_hash = ::Hash::Compositing.new
77
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
78
78
 
79
79
  cascading_composite_hash[ :A ] = 1
80
80
  cascading_composite_hash.should == { :A => 1 }
@@ -97,8 +97,8 @@ describe ::CompositingHash do
97
97
 
98
98
  it 'can add elements' do
99
99
 
100
- cascading_composite_hash = ::CompositingHash.new
101
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
100
+ cascading_composite_hash = ::Hash::Compositing.new
101
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
102
102
 
103
103
  cascading_composite_hash[ :some_setting ] = :some_value
104
104
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -127,8 +127,8 @@ describe ::CompositingHash do
127
127
 
128
128
  it 'can delete elements' do
129
129
 
130
- cascading_composite_hash = ::CompositingHash.new
131
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
130
+ cascading_composite_hash = ::Hash::Compositing.new
131
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
132
132
 
133
133
  cascading_composite_hash.store( :some_setting, :some_value )
134
134
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -161,8 +161,8 @@ describe ::CompositingHash do
161
161
 
162
162
  it 'can delete elements with a block' do
163
163
 
164
- cascading_composite_hash = ::CompositingHash.new
165
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
164
+ cascading_composite_hash = ::Hash::Compositing.new
165
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
166
166
 
167
167
  cascading_composite_hash.store( :some_setting, :some_value )
168
168
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -197,8 +197,8 @@ describe ::CompositingHash do
197
197
 
198
198
  it 'can delete elements with a block' do
199
199
 
200
- cascading_composite_hash = ::CompositingHash.new
201
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
200
+ cascading_composite_hash = ::Hash::Compositing.new
201
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
202
202
 
203
203
  cascading_composite_hash.store( :some_setting, :some_value )
204
204
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -233,8 +233,8 @@ describe ::CompositingHash do
233
233
 
234
234
  it 'can keep elements with a block' do
235
235
 
236
- cascading_composite_hash = ::CompositingHash.new
237
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
236
+ cascading_composite_hash = ::Hash::Compositing.new
237
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
238
238
 
239
239
  cascading_composite_hash.store( :some_setting, :some_value )
240
240
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -269,8 +269,8 @@ describe ::CompositingHash do
269
269
 
270
270
  it 'can keep elements with a block' do
271
271
 
272
- cascading_composite_hash = ::CompositingHash.new
273
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
272
+ cascading_composite_hash = ::Hash::Compositing.new
273
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
274
274
 
275
275
  cascading_composite_hash.store( :some_setting, :some_value )
276
276
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -306,8 +306,8 @@ describe ::CompositingHash do
306
306
 
307
307
  it 'can merge from another hash' do
308
308
 
309
- cascading_composite_hash = ::CompositingHash.new
310
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
309
+ cascading_composite_hash = ::Hash::Compositing.new
310
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
311
311
 
312
312
  cascading_composite_hash.merge!( :some_setting => :some_value )
313
313
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -330,8 +330,8 @@ describe ::CompositingHash do
330
330
 
331
331
  it 'can replace existing elements with others' do
332
332
 
333
- cascading_composite_hash = ::CompositingHash.new
334
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
333
+ cascading_composite_hash = ::Hash::Compositing.new
334
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
335
335
 
336
336
  cascading_composite_hash.replace( :some_setting => :some_value )
337
337
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -350,8 +350,8 @@ describe ::CompositingHash do
350
350
 
351
351
  it 'can shift the first element' do
352
352
 
353
- cascading_composite_hash = ::CompositingHash.new
354
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
353
+ cascading_composite_hash = ::Hash::Compositing.new
354
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
355
355
 
356
356
  cascading_composite_hash.store( :some_setting, :some_value )
357
357
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -377,8 +377,8 @@ describe ::CompositingHash do
377
377
 
378
378
  it 'can clear, causing present elements to be excluded' do
379
379
 
380
- cascading_composite_hash = ::CompositingHash.new
381
- sub_cascading_composite_hash = ::CompositingHash.new( cascading_composite_hash )
380
+ cascading_composite_hash = ::Hash::Compositing.new
381
+ sub_cascading_composite_hash = ::Hash::Compositing.new( cascading_composite_hash )
382
382
 
383
383
  cascading_composite_hash.store( :some_setting, :some_value )
384
384
  cascading_composite_hash.should == { :some_setting => :some_value }
@@ -406,7 +406,7 @@ describe ::CompositingHash do
406
406
 
407
407
  it 'has a hook that is called before setting a value; return value is used in place of object' do
408
408
 
409
- class ::CompositingHash::SubMockPreSet < ::CompositingHash
409
+ class ::Hash::Compositing::SubMockPreSet < ::Hash::Compositing
410
410
 
411
411
  def pre_set_hook( key, object, is_insert = false )
412
412
  return :some_other_value
@@ -414,7 +414,7 @@ describe ::CompositingHash do
414
414
 
415
415
  end
416
416
 
417
- cascading_composite_hash = ::CompositingHash::SubMockPreSet.new
417
+ cascading_composite_hash = ::Hash::Compositing::SubMockPreSet.new
418
418
 
419
419
  cascading_composite_hash[ :some_key ] = :some_value
420
420
 
@@ -428,7 +428,7 @@ describe ::CompositingHash do
428
428
 
429
429
  it 'has a hook that is called after setting a value' do
430
430
 
431
- class ::CompositingHash::SubMockPostSet < ::CompositingHash
431
+ class ::Hash::Compositing::SubMockPostSet < ::Hash::Compositing
432
432
 
433
433
  def post_set_hook( key, object, is_insert = false )
434
434
  unless key == :some_other_key
@@ -439,7 +439,7 @@ describe ::CompositingHash do
439
439
 
440
440
  end
441
441
 
442
- cascading_composite_hash = ::CompositingHash::SubMockPostSet.new
442
+ cascading_composite_hash = ::Hash::Compositing::SubMockPostSet.new
443
443
 
444
444
  cascading_composite_hash[ :some_key ] = :some_value
445
445
 
@@ -454,7 +454,7 @@ describe ::CompositingHash do
454
454
 
455
455
  it 'has a hook that is called before getting a value; if return value is false, get does not occur' do
456
456
 
457
- class ::CompositingHash::SubMockPreGet < ::CompositingHash
457
+ class ::Hash::Compositing::SubMockPreGet < ::Hash::Compositing
458
458
 
459
459
  def pre_get_hook( key )
460
460
  return false
@@ -462,7 +462,7 @@ describe ::CompositingHash do
462
462
 
463
463
  end
464
464
 
465
- cascading_composite_hash = ::CompositingHash::SubMockPreGet.new
465
+ cascading_composite_hash = ::Hash::Compositing::SubMockPreGet.new
466
466
 
467
467
  cascading_composite_hash[ :some_key ] = :some_value
468
468
  cascading_composite_hash[ :some_key ].should == nil
@@ -477,7 +477,7 @@ describe ::CompositingHash do
477
477
 
478
478
  it 'has a hook that is called after getting a value' do
479
479
 
480
- class ::CompositingHash::SubMockPostGet < ::CompositingHash
480
+ class ::Hash::Compositing::SubMockPostGet < ::Hash::Compositing
481
481
 
482
482
  def post_get_hook( key, object )
483
483
  self[ :some_other_key ] = :some_other_value
@@ -486,7 +486,7 @@ describe ::CompositingHash do
486
486
 
487
487
  end
488
488
 
489
- cascading_composite_hash = ::CompositingHash::SubMockPostGet.new
489
+ cascading_composite_hash = ::Hash::Compositing::SubMockPostGet.new
490
490
 
491
491
  cascading_composite_hash[ :some_key ] = :some_value
492
492
 
@@ -505,7 +505,7 @@ describe ::CompositingHash do
505
505
 
506
506
  it 'has a hook that is called before deleting an key; if return value is false, delete does not occur' do
507
507
 
508
- class ::CompositingHash::SubMockPreDelete < ::CompositingHash
508
+ class ::Hash::Compositing::SubMockPreDelete < ::Hash::Compositing
509
509
 
510
510
  def pre_delete_hook( key )
511
511
  return false
@@ -513,7 +513,7 @@ describe ::CompositingHash do
513
513
 
514
514
  end
515
515
 
516
- cascading_composite_hash = ::CompositingHash::SubMockPreDelete.new
516
+ cascading_composite_hash = ::Hash::Compositing::SubMockPreDelete.new
517
517
 
518
518
  cascading_composite_hash[ :some_key ] = :some_value
519
519
  cascading_composite_hash.delete( :some_key )
@@ -528,7 +528,7 @@ describe ::CompositingHash do
528
528
 
529
529
  it 'has a hook that is called after deleting an key' do
530
530
 
531
- class ::CompositingHash::SubMockPostDelete < ::CompositingHash
531
+ class ::Hash::Compositing::SubMockPostDelete < ::Hash::Compositing
532
532
 
533
533
  def post_delete_hook( key, object )
534
534
  unless key == :some_other_key
@@ -538,7 +538,7 @@ describe ::CompositingHash do
538
538
 
539
539
  end
540
540
 
541
- cascading_composite_hash = ::CompositingHash::SubMockPostDelete.new
541
+ cascading_composite_hash = ::Hash::Compositing::SubMockPostDelete.new
542
542
 
543
543
  cascading_composite_hash[ :some_key ] = :some_value
544
544
  cascading_composite_hash[ :some_other_key ] = :some_other_value
@@ -554,7 +554,7 @@ describe ::CompositingHash do
554
554
 
555
555
  it 'has a hook that is called before setting a value that has been passed by a parent; return value is used in place of object' do
556
556
 
557
- class ::CompositingHash::SubMockChildPreSet < ::CompositingHash
557
+ class ::Hash::Compositing::SubMockChildPreSet < ::Hash::Compositing
558
558
 
559
559
  def child_pre_set_hook( key, object, is_insert = false )
560
560
  return :some_other_value
@@ -562,8 +562,8 @@ describe ::CompositingHash do
562
562
 
563
563
  end
564
564
 
565
- cascading_composite_hash = ::CompositingHash::SubMockChildPreSet.new
566
- sub_cascading_composite_hash = ::CompositingHash::SubMockChildPreSet.new( cascading_composite_hash )
565
+ cascading_composite_hash = ::Hash::Compositing::SubMockChildPreSet.new
566
+ sub_cascading_composite_hash = ::Hash::Compositing::SubMockChildPreSet.new( cascading_composite_hash )
567
567
 
568
568
  cascading_composite_hash[ :some_key ] = :some_value
569
569
 
@@ -578,7 +578,7 @@ describe ::CompositingHash do
578
578
 
579
579
  it 'has a hook that is called after setting a value passed by a parent' do
580
580
 
581
- class ::CompositingHash::SubMockChildPostSet < ::CompositingHash
581
+ class ::Hash::Compositing::SubMockChildPostSet < ::Hash::Compositing
582
582
 
583
583
  def child_post_set_hook( key, object, is_insert = false )
584
584
  self[ :some_other_key ] = :some_other_value
@@ -586,8 +586,8 @@ describe ::CompositingHash do
586
586
 
587
587
  end
588
588
 
589
- cascading_composite_hash = ::CompositingHash::SubMockChildPostSet.new
590
- sub_cascading_composite_hash = ::CompositingHash::SubMockChildPostSet.new( cascading_composite_hash )
589
+ cascading_composite_hash = ::Hash::Compositing::SubMockChildPostSet.new
590
+ sub_cascading_composite_hash = ::Hash::Compositing::SubMockChildPostSet.new( cascading_composite_hash )
591
591
  cascading_composite_hash[ :some_key ] = :some_value
592
592
 
593
593
  cascading_composite_hash.should == { :some_key => :some_value }
@@ -602,7 +602,7 @@ describe ::CompositingHash do
602
602
 
603
603
  it 'has a hook that is called before deleting an key that has been passed by a parent; if return value is false, delete does not occur' do
604
604
 
605
- class ::CompositingHash::SubMockChildPreDelete < ::CompositingHash
605
+ class ::Hash::Compositing::SubMockChildPreDelete < ::Hash::Compositing
606
606
 
607
607
  def child_pre_delete_hook( key )
608
608
  false
@@ -610,8 +610,8 @@ describe ::CompositingHash do
610
610
 
611
611
  end
612
612
 
613
- cascading_composite_hash = ::CompositingHash::SubMockChildPreDelete.new
614
- sub_cascading_composite_hash = ::CompositingHash::SubMockChildPreDelete.new( cascading_composite_hash )
613
+ cascading_composite_hash = ::Hash::Compositing::SubMockChildPreDelete.new
614
+ sub_cascading_composite_hash = ::Hash::Compositing::SubMockChildPreDelete.new( cascading_composite_hash )
615
615
  cascading_composite_hash[ :some_key ] = :some_value
616
616
  cascading_composite_hash.delete( :some_key )
617
617
 
@@ -626,7 +626,7 @@ describe ::CompositingHash do
626
626
 
627
627
  it 'has a hook that is called after deleting an key passed by a parent' do
628
628
 
629
- class ::CompositingHash::SubMockChildPostDelete < ::CompositingHash
629
+ class ::Hash::Compositing::SubMockChildPostDelete < ::Hash::Compositing
630
630
 
631
631
  def child_post_delete_hook( key, object )
632
632
  delete( :some_other_key )
@@ -634,8 +634,8 @@ describe ::CompositingHash do
634
634
 
635
635
  end
636
636
 
637
- cascading_composite_hash = ::CompositingHash::SubMockChildPostDelete.new
638
- sub_cascading_composite_hash = ::CompositingHash::SubMockChildPostDelete.new( cascading_composite_hash )
637
+ cascading_composite_hash = ::Hash::Compositing::SubMockChildPostDelete.new
638
+ sub_cascading_composite_hash = ::Hash::Compositing::SubMockChildPostDelete.new( cascading_composite_hash )
639
639
  cascading_composite_hash[ :some_key ] = :some_value
640
640
  sub_cascading_composite_hash[ :some_other_key ] = :some_other_value
641
641
  cascading_composite_hash.delete( :some_key )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash-compositing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -42,7 +42,6 @@ files:
42
42
  - lib/hash-compositing.rb
43
43
  - spec/hash/compositing_spec.rb
44
44
  - README.md
45
- - README.rdoc
46
45
  homepage: http://rubygems.org/gems/hash-compositing
47
46
  licenses: []
48
47
  post_install_message:
data/README.rdoc DELETED
File without changes