unmixer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/README.md +89 -0
- data/Rakefile +13 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/unmixer/2.1.0/internal.h +889 -0
- data/ext/unmixer/2.2.0/internal.h +1182 -0
- data/ext/unmixer/2.3.0/internal.h +1404 -0
- data/ext/unmixer/2.4.0/internal.h +1699 -0
- data/ext/unmixer/extconf.rb +2 -0
- data/ext/unmixer/unmixer.c +54 -0
- data/lib/unmixer.rb +2 -0
- data/lib/unmixer/core_refine.rb +45 -0
- data/lib/unmixer/version.rb +3 -0
- data/unmixer.gemspec +29 -0
- metadata +118 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <ruby/version.h>
|
3
|
+
|
4
|
+
#ifdef WARN_UNUSED_RESULT
|
5
|
+
#undef WARN_UNUSED_RESULT
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#if RUBY_API_VERSION_CODE >= 20400
|
9
|
+
# include "2.4.0/internal.h"
|
10
|
+
#elif RUBY_API_VERSION_CODE >= 20300
|
11
|
+
# include "2.3.0/internal.h"
|
12
|
+
#elif RUBY_API_VERSION_CODE >= 20200
|
13
|
+
# include "2.2.0/internal.h"
|
14
|
+
#elif RUBY_API_VERSION_CODE >= 20100
|
15
|
+
# include "2.1.0/internal.h"
|
16
|
+
#else
|
17
|
+
# include <ruby/backward/classext.h>
|
18
|
+
#endif
|
19
|
+
#define RCLASS_SUPER(c) (RCLASS(c)->super)
|
20
|
+
#define RB_CLEAR_CACHE_BY_CLASS(c) rb_clear_method_cache_by_class(c)
|
21
|
+
|
22
|
+
|
23
|
+
static void unmixin(VALUE self, VALUE mod) {
|
24
|
+
};
|
25
|
+
|
26
|
+
static VALUE rb_m_unmixin(VALUE self, VALUE mod) {
|
27
|
+
Check_Type(mod, T_MODULE);
|
28
|
+
|
29
|
+
// printf("self:%x\n", self);
|
30
|
+
// printf("mod:%x\n", mod);
|
31
|
+
VALUE superklass = RCLASS_SUPER(self);
|
32
|
+
VALUE lastklass = self;
|
33
|
+
|
34
|
+
do {
|
35
|
+
// printf("------------------------------\n");
|
36
|
+
// printf("class:%s\n", rb_obj_classname(superklass));
|
37
|
+
// printf("class:%s\n", rb_class2name(superklass));
|
38
|
+
if(RB_TYPE_P(superklass, RUBY_T_CLASS) && superklass != self) break;
|
39
|
+
if(superklass == mod || RCLASS_M_TBL(superklass) == RCLASS_M_TBL(mod)) {
|
40
|
+
RCLASS_SUPER(lastklass) = RCLASS_SUPER(superklass);
|
41
|
+
RB_CLEAR_CACHE_BY_CLASS(lastklass);
|
42
|
+
break;
|
43
|
+
}
|
44
|
+
lastklass = superklass;
|
45
|
+
superklass = RCLASS_SUPER(superklass);
|
46
|
+
} while (superklass);
|
47
|
+
|
48
|
+
return self;
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
void Init_unmixer(void) {
|
53
|
+
rb_define_private_method(rb_cModule, "unmixer_unmixin", RUBY_METHOD_FUNC(rb_m_unmixin), 1);
|
54
|
+
}
|
data/lib/unmixer.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "unmixer/unmixer"
|
2
|
+
|
3
|
+
module Unmixer
|
4
|
+
refine Module do
|
5
|
+
private
|
6
|
+
alias_method :unmixin, :unmixer_unmixin
|
7
|
+
|
8
|
+
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
|
10
|
+
unmixer_unmixin mod
|
11
|
+
end
|
12
|
+
alias_method :uninclude, :unmixer_uninclude
|
13
|
+
|
14
|
+
def unmixer_unprepend mod
|
15
|
+
return unless ancestors.tap { |it| break it[0, it.find_index(self)] }.include? mod
|
16
|
+
unmixer_unmixin mod
|
17
|
+
end
|
18
|
+
alias_method :unprepend, :unmixer_unprepend
|
19
|
+
end
|
20
|
+
|
21
|
+
refine Object do
|
22
|
+
alias_method :unmixer_original_extend, :extend
|
23
|
+
def unmixer_extend mod
|
24
|
+
unmixer_original_extend mod
|
25
|
+
|
26
|
+
if block_given?
|
27
|
+
yield(self)
|
28
|
+
unmixer_unextend mod
|
29
|
+
end
|
30
|
+
end
|
31
|
+
alias_method :extend, :unmixer_extend
|
32
|
+
|
33
|
+
def unmixer_unextend mod
|
34
|
+
return unless singleton_class.ancestors.include? mod
|
35
|
+
|
36
|
+
singleton_class.__send__ :unmixer_unmixin, mod
|
37
|
+
|
38
|
+
if block_given?
|
39
|
+
yield(self)
|
40
|
+
unmixer_original_extend mod
|
41
|
+
end
|
42
|
+
end
|
43
|
+
alias_method :unextend, :unmixer_unextend
|
44
|
+
end
|
45
|
+
end
|
data/unmixer.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'unmixer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "unmixer"
|
8
|
+
spec.version = Unmixer::VERSION
|
9
|
+
spec.authors = ["manga_osyo"]
|
10
|
+
spec.email = ["manga.osyo@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Remove mixin modules.}
|
13
|
+
spec.description = %q{Remove mixin modules.}
|
14
|
+
spec.homepage = "https://github.com/osyo-manga/gem-unmixer"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.extensions = %w[ext/unmixer/extconf.rb]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
26
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "rake-compiler"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unmixer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- manga_osyo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-compiler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Remove mixin modules.
|
70
|
+
email:
|
71
|
+
- manga.osyo@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions:
|
74
|
+
- ext/unmixer/extconf.rb
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- ext/unmixer/2.1.0/internal.h
|
86
|
+
- ext/unmixer/2.2.0/internal.h
|
87
|
+
- ext/unmixer/2.3.0/internal.h
|
88
|
+
- ext/unmixer/2.4.0/internal.h
|
89
|
+
- ext/unmixer/extconf.rb
|
90
|
+
- ext/unmixer/unmixer.c
|
91
|
+
- lib/unmixer.rb
|
92
|
+
- lib/unmixer/core_refine.rb
|
93
|
+
- lib/unmixer/version.rb
|
94
|
+
- unmixer.gemspec
|
95
|
+
homepage: https://github.com/osyo-manga/gem-unmixer
|
96
|
+
licenses: []
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.6.8
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Remove mixin modules.
|
118
|
+
test_files: []
|