1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
module N
def i_n
puts 'i_m'
end
def self.c_n
puts 'c_n'
end
puts '- 0 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
end
module M
def i_m
puts 'i_m'
end
def self.c_m
puts 'c_m'
end
puts '- 1 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
N.class_eval {
puts '- 2 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
}
def N.test3
puts '- 3 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
end
N.class_eval {
def N.test4
puts '- 4 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
end
}
def N.test5
N.class_eval {
puts '- 5 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
}
end
def N.test6
$p = proc {
puts '- 6 -'
(alias xxx i_m; puts 'i_m OK') rescue p $!
(alias xxx c_m; puts 'c_m OK') rescue p $!
(alias xxx i_n; puts 'i_n OK') rescue p $!
(alias xxx c_n; puts 'c_n OK') rescue p $!
puts
}
1.times &$p
end
end
class D
def i_d
puts 'i_d'
end
def self.c_d
puts 'c_d'
end
end
class C
def i_c
puts 'i_c'
end
def self.c_c
puts 'c_c'
end
D.class_eval {
puts '- !7 -'
(alias xxx i_c; puts 'i_c OK') rescue p $!
(alias xxx c_c; puts 'c_c OK') rescue p $!
(alias xxx i_d; puts 'i_d OK') rescue p $!
(alias xxx c_d; puts 'c_d OK') rescue p $!
puts
}
D.send(:define_method, :test7) {
puts '- 8 -'
(alias xxx i_c; puts 'i_c OK') rescue p $!
(alias xxx c_c; puts 'c_c OK') rescue p $!
(alias xxx i_d; puts 'i_d OK') rescue p $!
(alias xxx c_d; puts 'c_d OK') rescue p $!
puts
}
end
N.test3
N.test4
N.test5
N.test6
D.new.test7
|