According to Wikipedia, a monkey patch is:
a way to extend or modify the runtime code of dynamic languages [...] without altering the original source code.
The following statement from the same entry confused me:
In Ruby, the term monkey patch was misunderstood to mean any dynamic modification to a class and is often used as a synonym for dynamically modifying any class at runtime.
I would like to know the exact meaning of monkey patching in Ruby. Is it doing something like the following, or is it something else?
class String
def foo
"foo"
end
end
See Question&Answers more detail:os