refine
Ruby is designed to solve monkey repair and inheritance issues, where it is intended to restrict a monkey patch to class instances within a specific namespace.
, ( ) mixins.
, , .
:
module MyModule
def my_method
"hello"
end
end
include MyModule
puts my_method
module MyOtherModule
extend MyModule
puts my_method
def my_method
"goodbye"
end
extend self
puts my_method
end
puts my_method
, "monkey-patch" MyOtherModule
refine
.
MyModule
(MyModule
), .
, , , , ... , refine
.