unmixer 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 744abd9d02195ad0c1cbfb95da0ec26474417dba
4
- data.tar.gz: 8c9bafa0140645769984aaae48014b6df80cae53
3
+ metadata.gz: 31f9b48b391a4775a211798f0b6fc8bf80780c5c
4
+ data.tar.gz: daf1b1a3ec1de1b8f3c43277ceaea0414a9a82a2
5
5
  SHA512:
6
- metadata.gz: ea97559d1ef82901e5641475da7ca286f401b38936576071145d195142e2b58d7df0f82f0020a83635d6a10c2316e2420ed36f73b59bde1b5af77aebfd1c7f92
7
- data.tar.gz: e15667eb6ffe2e410232aa6d5b921ac4aa1d3234bebd25ad376a2f1f7f31cf16f2f085c5a1e76be73ee33b61e86fabe2c2bc86da1fce52e9587c67fce3eb795a
6
+ metadata.gz: d9f6d675fbd5441c81d0ea8d6bb69f624090f83e9b89ae96a96723346e0fdf45171a116ec0c4e2c295c4c4b63d8f9a03d75efe6cf50ecec3cd25dd5c2f708518
7
+ data.tar.gz: ebe7174f917f60af175d00d0982c86f472a7b47b8aac83c0f522eef4db4b864dfd8179bdc5a85d9c499c3df8148f01b8437b1eade2350d68a5d64007c5f0b7e3
data/README.md CHANGED
@@ -90,6 +90,11 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/osyo-m
90
90
 
91
91
  ## Release Note
92
92
 
93
+ #### 0.3.0
94
+
95
+ * Fix accessibility `#unmixin`/`#uninclude`/`#unprepend` to public.
96
+ * Remove `#unextend` with block.
97
+
93
98
  #### 0.2.0
94
99
 
95
100
  * Fix `#extend`/`#unextend` result
@@ -50,5 +50,5 @@ static VALUE rb_m_unmixin(VALUE self, VALUE mod) {
50
50
 
51
51
 
52
52
  void Init_unmixer(void) {
53
- rb_define_private_method(rb_cModule, "unmixer_unmixin", RUBY_METHOD_FUNC(rb_m_unmixin), 1);
53
+ rb_define_method(rb_cModule, "unmixer_unmixin", RUBY_METHOD_FUNC(rb_m_unmixin), 1);
54
54
  }
@@ -2,18 +2,26 @@ require "unmixer/unmixer"
2
2
 
3
3
  module Unmixer
4
4
  refine Module do
5
- private
6
- alias_method :unmixin, :unmixer_unmixin
5
+ alias_method :unmixin, :unmixer_unmixin
7
6
 
8
7
  def unmixer_uninclude mod, &block
9
- return unless ancestors.tap { |it| break it[it.find_index(self)+1..it.find_index(superclass)-1] }.include? mod
8
+ return self unless ancestors.tap { |it| break it[it.find_index(self)+1..it.find_index(superclass)-1] }.include? mod
10
9
  unmixer_unmixin mod
11
10
  end
12
11
  alias_method :uninclude, :unmixer_uninclude
13
12
 
14
13
  def unmixer_unprepend mod
15
- return unless ancestors.tap { |it| break it[0, it.find_index(self)] }.include? mod
14
+ return self unless ancestors.tap { |it| break it[0, it.find_index(self)] }.include? mod
16
15
  unmixer_unmixin mod
16
+
17
+ if block_given?
18
+ begin
19
+ yield(self)
20
+ ensure
21
+ unmixer_original_extend mod
22
+ end
23
+ end
24
+ self
17
25
  end
18
26
  alias_method :unprepend, :unmixer_unprepend
19
27
  end
@@ -21,7 +29,7 @@ module Unmixer
21
29
  refine Object do
22
30
  alias_method :unmixer_original_extend, :extend
23
31
  def unmixer_extend mod
24
- result = unmixer_original_extend mod
32
+ unmixer_original_extend mod
25
33
 
26
34
  if block_given?
27
35
  begin
@@ -30,7 +38,7 @@ module Unmixer
30
38
  unmixer_unextend mod
31
39
  end
32
40
  end
33
- result
41
+ self
34
42
  end
35
43
  alias_method :extend, :unmixer_extend
36
44
 
@@ -39,13 +47,14 @@ module Unmixer
39
47
 
40
48
  singleton_class.__send__ :unmixer_unmixin, mod
41
49
 
42
- if block_given?
43
- begin
44
- yield(self)
45
- ensure
46
- unmixer_original_extend mod
47
- end
48
- end
50
+ # NOTE: 複数のモジュールが mixin されている場合、同じ位置に mixin 出来ない
51
+ # if block_given?
52
+ # begin
53
+ # yield(self)
54
+ # ensure
55
+ # unmixer_original_extend mod
56
+ # end
57
+ # end
49
58
  self
50
59
  end
51
60
  alias_method :unextend, :unmixer_unextend
@@ -1,3 +1,3 @@
1
1
  module Unmixer
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unmixer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - manga_osyo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler