kagemusha 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.ja.txt +22 -0
- data/History.txt +4 -0
- data/Manifest.txt +1 -0
- data/lib/kagemusha/core.rb +6 -2
- data/lib/kagemusha/version.rb +2 -2
- data/test/test_bugs.rb +15 -1
- data/test/test_rand.rb +6 -1
- metadata +4 -2
data/History.ja.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
== 0.0.5 2008-07-16
|
3
|
+
|
4
|
+
* Kernelモジュールのメソッドの復元に失敗する不具合を修正
|
5
|
+
|
6
|
+
== 0.0.4 2008-07-09
|
7
|
+
|
8
|
+
* インスタンスメソッド、クラスメソッドの復元に失敗する不具合を修正
|
9
|
+
* newgem 0.25.0で生成したパッケージに変更
|
10
|
+
|
11
|
+
== 0.0.3 2007-09-10
|
12
|
+
|
13
|
+
* インスタンスメソッド、クラスメソッドの追加/削除機能を追加
|
14
|
+
|
15
|
+
== 0.0.2 2007-08-27
|
16
|
+
|
17
|
+
* ブロックによる初期化機能を追加
|
18
|
+
* 各種スタイルでの記述例を追加
|
19
|
+
|
20
|
+
== 0.0.1 2007-08-15
|
21
|
+
|
22
|
+
* 初版
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/kagemusha/core.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
#==============================================================================#
|
3
|
-
# $Id: core.rb
|
3
|
+
# $Id: core.rb 67 2008-07-16 04:15:10Z yuyakato $
|
4
4
|
#==============================================================================#
|
5
5
|
|
6
6
|
class Kagemusha #:nodoc:
|
@@ -73,7 +73,11 @@ class Kagemusha #:nodoc:
|
|
73
73
|
begin
|
74
74
|
# replace method
|
75
75
|
method = @klass.instance_method(name)
|
76
|
-
|
76
|
+
if @klass == Kernel
|
77
|
+
method = :remove unless @klass.methods(false).include?(name.to_s)
|
78
|
+
else
|
79
|
+
method = :remove unless @klass.instance_methods(false).include?(name.to_s)
|
80
|
+
end
|
77
81
|
@klass.instance_eval { define_method(name, proc) }
|
78
82
|
original_instance_methods[name] = method
|
79
83
|
rescue NameError
|
data/lib/kagemusha/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
2
|
#==============================================================================#
|
3
|
-
# $Id: version.rb
|
3
|
+
# $Id: version.rb 69 2008-07-16 04:18:55Z yuyakato $
|
4
4
|
#==============================================================================#
|
5
5
|
|
6
6
|
class Kagemusha #:nodoc:
|
7
7
|
module VERSION #:nodoc:
|
8
8
|
MAJOR = 0
|
9
9
|
MINOR = 0
|
10
|
-
TINY =
|
10
|
+
TINY = 5
|
11
11
|
|
12
12
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
13
13
|
end
|
data/test/test_bugs.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
#==============================================================================#
|
3
|
-
# $Id: test_bugs.rb
|
3
|
+
# $Id: test_bugs.rb 66 2008-07-16 03:04:32Z yuyakato $
|
4
4
|
#==============================================================================#
|
5
5
|
|
6
6
|
require File.dirname(__FILE__) + "/test_helper.rb"
|
@@ -87,6 +87,20 @@ class TestBugs < Test::Unit::TestCase
|
|
87
87
|
|
88
88
|
assert_equal(:original, child_c.target)
|
89
89
|
end
|
90
|
+
|
91
|
+
def test_report02
|
92
|
+
musha = Kagemusha.new(Kernel)
|
93
|
+
musha.def(:Integer) { :replaced }
|
94
|
+
|
95
|
+
assert(1, Integer("1"))
|
96
|
+
|
97
|
+
musha.swap {
|
98
|
+
assert_equal(:replaced, Integer("1"))
|
99
|
+
}
|
100
|
+
|
101
|
+
# NoMethodError: undefined method `Integer' for #<TestBugs:0x.......>
|
102
|
+
assert(1, Integer("1"))
|
103
|
+
end
|
90
104
|
end
|
91
105
|
|
92
106
|
#==============================================================================#
|
data/test/test_rand.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
#==============================================================================#
|
3
|
-
# $Id: test_rand.rb
|
3
|
+
# $Id: test_rand.rb 68 2008-07-16 04:17:33Z yuyakato $
|
4
4
|
#==============================================================================#
|
5
5
|
|
6
6
|
require File.dirname(__FILE__) + "/test_helper.rb"
|
@@ -15,6 +15,9 @@ class TestKagemushaRand < Test::Unit::TestCase
|
|
15
15
|
def test_always
|
16
16
|
musha = Kagemusha::Rand.always(1)
|
17
17
|
assert_equal(Kernel, musha.instance_eval { @klass })
|
18
|
+
|
19
|
+
assert_equal([0, 1, 2], (1..100).map { rand(3) }.sort.uniq)
|
20
|
+
|
18
21
|
musha.swap {
|
19
22
|
assert_equal(1, rand)
|
20
23
|
assert_equal(1, rand(2))
|
@@ -22,6 +25,8 @@ class TestKagemushaRand < Test::Unit::TestCase
|
|
22
25
|
assert_equal(1, rand(4))
|
23
26
|
assert_equal(1, rand(5))
|
24
27
|
}
|
28
|
+
|
29
|
+
assert_equal([0, 1, 2], (1..100).map { rand(3) }.sort.uniq)
|
25
30
|
end
|
26
31
|
|
27
32
|
def test_always_with_block
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kagemusha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya Kato
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-16 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
|
32
32
|
extra_rdoc_files:
|
33
|
+
- History.ja.txt
|
33
34
|
- History.txt
|
34
35
|
- License.txt
|
35
36
|
- Manifest.txt
|
@@ -37,6 +38,7 @@ extra_rdoc_files:
|
|
37
38
|
- README.txt
|
38
39
|
- website/index.txt
|
39
40
|
files:
|
41
|
+
- History.ja.txt
|
40
42
|
- History.txt
|
41
43
|
- License.txt
|
42
44
|
- Manifest.txt
|