module_chain_method 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -4,11 +4,11 @@ class Module
4
4
  def self.included target
5
5
  # $stderr.puts "ChainMethod #{self.inspect}.included #{target}"
6
6
  super
7
- target.extend(ClassMethods) if Class === target
8
- target.extend(ModuleMethods) if Module === target
9
- if target.method_defined?(:included)
7
+ if target.method_defined?(:included) && ! target.method_defined?(:included_without_ChainMethod)
10
8
  target.send(:alias_method, :included_without_ChainMethod, :included)
11
9
  end
10
+ target.extend(ClassMethods) if Class === target
11
+ target.extend(ModuleMethods) if Module === target
12
12
  end
13
13
 
14
14
  module ModuleMethods
@@ -28,7 +28,29 @@ class TestModuleChainMethod < Test::Unit::TestCase
28
28
  )
29
29
 
30
30
  end
31
- end
31
+
32
+ should "handle multiple includes" do
33
+ Module::ChainMethod::Test::Foo.class_eval do
34
+ include Module::ChainMethod::Test::MyMixin
35
+ end
36
+ assert_equal(
37
+ [
38
+ "MyMixin.included Module::ChainMethod::Test::Foo",
39
+ "MyMixin.included Module::ChainMethod::Test::Foo",
40
+ ],
41
+ Module::ChainMethod::Test::MyMixin.instance_variable_get("@calls")
42
+ )
43
+
44
+ f = Module::ChainMethod::Test::Foo.new
45
+ f.foo
46
+ f.bar
47
+ assert_equal(
48
+ [ "MyMixin#foo", "Foo#foo", "Foo#bar" ],
49
+ f.instance_variable_get("@calls")
50
+ )
51
+
52
+ end
53
+ end
32
54
 
33
55
 
34
56
  ######################################################################
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: module_chain_method
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kurt Stephens