module-cluster 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -313,10 +313,10 @@ module ::Module::Cluster
313
313
  hooked_instance.extend( this_module )
314
314
  end
315
315
  end
316
-
316
+
317
317
  # if we have a block it runs last
318
318
  if this_block = this_frame.block
319
- this_block.call( hooked_instance )
319
+ this_frame.owner.module_exec( hooked_instance, & this_block )
320
320
  end
321
321
 
322
322
  end
@@ -28,5 +28,3 @@ files = [
28
28
  files.each do |this_file|
29
29
  require_relative( File.join( basepath, this_file ) + '.rb' )
30
30
  end
31
-
32
- require_relative( basepath + '.rb' )
@@ -60,7 +60,7 @@ describe ::Module::Cluster do
60
60
 
61
61
  # after - block only
62
62
  it 'can create an after-include hook to run a block' do
63
- module ::Module::Cluster::BeforeIncludeBlockHookMock
63
+ module ::Module::Cluster::AfterIncludeBlockHookMock
64
64
 
65
65
  block_ran = false
66
66
 
@@ -243,7 +243,7 @@ describe ::Module::Cluster do
243
243
 
244
244
  # before - block only
245
245
  it 'can create a before-extend hook to run a block' do
246
- module ::Module::Cluster::BeforeIncludeBlockHookMock
246
+ module ::Module::Cluster::BeforeExtendBlockHookMock
247
247
 
248
248
  block_ran = false
249
249
 
@@ -274,7 +274,7 @@ describe ::Module::Cluster do
274
274
 
275
275
  # after - block only
276
276
  it 'can create a after-extend hook to run a block' do
277
- module ::Module::Cluster::BeforeIncludeBlockHookMock
277
+ module ::Module::Cluster::AfterExtendBlockHookMock
278
278
 
279
279
  block_ran = false
280
280
 
@@ -467,7 +467,6 @@ describe ::Module::Cluster do
467
467
  extend ::Module::Cluster
468
468
  cluster( :cluster_name ).subclass.extend( A )
469
469
  def self.inherited( instance )
470
- instance.is_a?( A ).should == false
471
470
  super if defined?( super )
472
471
  instance.is_a?( A ).should == true
473
472
  end
@@ -477,6 +476,14 @@ describe ::Module::Cluster do
477
476
  is_a?( A ).should == true
478
477
  end
479
478
 
479
+ class AnotherClassB < AnotherClass
480
+ is_a?( A ).should == true
481
+ end
482
+
483
+ class AnotherClassC < AnotherClassB
484
+ is_a?( A ).should == true
485
+ end
486
+
480
487
  end
481
488
  end
482
489
 
@@ -497,9 +504,8 @@ describe ::Module::Cluster do
497
504
  block_ran = true
498
505
  instance.is_a?( A ).should == true
499
506
  end
500
- cluster( :cluster_name ).subclass.extend( A, & block )
507
+ cluster( :cluster_name ).subclass.cascade.extend( A, & block )
501
508
  def self.inherited( instance )
502
- instance.is_a?( A ).should == false
503
509
  super if defined?( super )
504
510
  instance.is_a?( A ).should == true
505
511
  end
@@ -511,6 +517,20 @@ describe ::Module::Cluster do
511
517
 
512
518
  block_ran.should == true
513
519
 
520
+ block_ran = false
521
+
522
+ class AnotherClassB < AnotherClass
523
+ is_a?( A ).should == true
524
+ end
525
+
526
+ block_ran.should == true
527
+
528
+ class AnotherClassC < AnotherClassB
529
+ is_a?( A ).should == true
530
+ end
531
+
532
+ block_ran.should == true
533
+
514
534
  end
515
535
  end
516
536
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: module-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Provides hooks via :included, :extended, :append_features, :extend_object,
15
15
  :inherited. Define behavior at hooks via simple interface.
@@ -50,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 1.9.1
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements: