⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (492 Bytes)
Bug #9326
ยป test.rb
nmueller (Nate Mueller)
, 12/31/2013 06:33 AM
module
Mixin
def
test_1
puts
'mixin 1'
super
end
def
test_2
puts
'mixin 2'
super
end
end
class
Base
def
test_1
puts
'base 1'
end
def
test_2
puts
'base 2'
end
end
class
Child
<
Base
include
Mixin
end
Child
.
send
(
:alias_method
,
:old_test_1
,
:test_1
)
Child
.
send
(
:define_method
,
:test_1
)
{
old_test_1
}
Child
.
send
(
:alias_method
,
:old_test_2
,
:test_2
)
Child
.
send
(
:define_method
,
:test_2
)
{
method
(
:old_test_2
).
call
}
Child
.
new
.
test_1
Child
.
new
.
test_2
(1-1/1)
Loading...