parallel-ancestry 1.0.2 → 1.0.3
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/CHANGELOG.rdoc +4 -0
- data/README.md +1 -1
- data/README.rdoc +1 -1
- data/lib/parallel-ancestry/ParallelAncestry.rb +4 -4
- data/spec/ParallelAncestry_spec.rb +11 -11
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
@@ -8,3 +8,7 @@ Replaces cascading-configuration-inheritance and cascading-configuration-ancesto
|
|
8
8
|
|
9
9
|
Added YARD docs.
|
10
10
|
Shortened :initialize_base_instance_for_include and :initialize_base_instance_for_extend parameters to remove reference to self, since self is already present as block receiver.
|
11
|
+
|
12
|
+
== 6/12/2012
|
13
|
+
|
14
|
+
Renamed :match_ancestor_searching_upward to :match_ancestor because ancestors are always found by searching upward.
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ Parallel ancestry instances support registration and lookup of arbitrarily decla
|
|
50
50
|
* ancestor_chain( instance, & match_ancestor_block )
|
51
51
|
* lowest_parents( instance, & match_ancestor_block )
|
52
52
|
* highest_children( instance, & match_ancestor_block )
|
53
|
-
*
|
53
|
+
* match_ancestor( instance, ancestor_match_block, & match_block )
|
54
54
|
|
55
55
|
match_block is always a proc or lambda that will be passed the next ancestor as the single parameter and is expected to return true or false whether or not the ancestor matches the condition.
|
56
56
|
|
data/README.rdoc
CHANGED
@@ -50,7 +50,7 @@ Parallel ancestry instances support registration and lookup of arbitrarily decla
|
|
50
50
|
* ancestor_chain( instance, & match_ancestor_block )
|
51
51
|
* lowest_parents( instance, & match_ancestor_block )
|
52
52
|
* highest_children( instance, & match_ancestor_block )
|
53
|
-
*
|
53
|
+
* match_ancestor( instance, ancestor_match_block, & match_block )
|
54
54
|
|
55
55
|
match_block is always a proc or lambda that will be passed the next ancestor as the single parameter and is expected to return true or false whether or not the ancestor matches the condition.
|
56
56
|
|
@@ -294,7 +294,7 @@ module ::ParallelAncestry
|
|
294
294
|
end
|
295
295
|
|
296
296
|
#####################################
|
297
|
-
#
|
297
|
+
# match_ancestor #
|
298
298
|
#####################################
|
299
299
|
|
300
300
|
# Returns the first ancestor (determined by ancestor_match_block) for which match_block is true.
|
@@ -312,7 +312,7 @@ module ::ParallelAncestry
|
|
312
312
|
# false
|
313
313
|
# end
|
314
314
|
# end
|
315
|
-
# ::ParallelAncestry.
|
315
|
+
# ::ParallelAncestry.match_ancestor( some_instance,
|
316
316
|
# ancestor_match_block ) do |this_parent|
|
317
317
|
# if this_parent.matches_arbitrary_condition
|
318
318
|
# true
|
@@ -321,7 +321,7 @@ module ::ParallelAncestry
|
|
321
321
|
# end
|
322
322
|
# end
|
323
323
|
# @return [Object]
|
324
|
-
def
|
324
|
+
def match_ancestor( instance, ancestor_match_block, & match_block )
|
325
325
|
|
326
326
|
matched_value = nil
|
327
327
|
|
@@ -343,7 +343,7 @@ module ::ParallelAncestry
|
|
343
343
|
|
344
344
|
else
|
345
345
|
|
346
|
-
matched_value =
|
346
|
+
matched_value = match_ancestor( this_ancestor.class,
|
347
347
|
ancestor_match_block,
|
348
348
|
& match_block )
|
349
349
|
|
@@ -263,7 +263,7 @@ describe ::ParallelAncestry do
|
|
263
263
|
end
|
264
264
|
|
265
265
|
#####################################
|
266
|
-
#
|
266
|
+
# match_ancestor #
|
267
267
|
#####################################
|
268
268
|
|
269
269
|
it 'can get the first defined configuration searching up the module configuration inheritance chain' do
|
@@ -331,26 +331,26 @@ describe ::ParallelAncestry do
|
|
331
331
|
instance_A.some_configuration = :some_value
|
332
332
|
instance_B.some_other_configuration = :some_other_value
|
333
333
|
|
334
|
-
|
335
|
-
|
334
|
+
match_ancestor( instance_B, match_ancestor_proc, & match_proc ).should == instance_A
|
335
|
+
match_ancestor( instance_C1, match_ancestor_proc, & match_proc ).should == instance_A
|
336
336
|
|
337
337
|
configuration_method = :some_other_configuration
|
338
|
-
|
339
|
-
|
338
|
+
match_ancestor( instance_B, match_ancestor_proc, & match_proc ).should == instance_B
|
339
|
+
match_ancestor( instance_C1, match_ancestor_proc, & match_proc ).should == instance_B
|
340
340
|
|
341
341
|
instance_C2.yet_another_configuration = :another_value
|
342
342
|
|
343
343
|
configuration_method = :yet_another_configuration
|
344
|
-
|
345
|
-
|
344
|
+
match_ancestor( instance_C1, match_ancestor_proc, & match_proc ).should == nil
|
345
|
+
match_ancestor( instance_D, match_ancestor_proc, & match_proc ).should == instance_C2
|
346
346
|
|
347
347
|
configuration_method = :some_configuration
|
348
|
-
|
349
|
-
|
348
|
+
match_ancestor( instance_C2, match_ancestor_proc, & match_proc ).should == instance_A
|
349
|
+
match_ancestor( instance_D, match_ancestor_proc, & match_proc ).should == instance_A
|
350
350
|
|
351
351
|
configuration_method = :some_other_configuration
|
352
|
-
|
353
|
-
|
352
|
+
match_ancestor( instance_C2, match_ancestor_proc, & match_proc ).should == instance_B
|
353
|
+
match_ancestor( instance_D, match_ancestor_proc, & match_proc ).should == instance_B
|
354
354
|
|
355
355
|
end
|
356
356
|
end
|