Advanced Ruby
Q99 / 100

How does Ruby's "Method#unbind" and "UnboundMethod#bind" pair work, and what is a practical use case?

Correct! Well done.

Incorrect.

The correct answer is B) unbind detaches a Method object from its receiver, producing an UnboundMethod that can later be bound to a compatible object via bind, useful for transplanting methods between objects of compatible classes (e.g. in module composition or testing)

B

Correct Answer

unbind detaches a Method object from its receiver, producing an UnboundMethod that can later be bound to a compatible object via bind, useful for transplanting methods between objects of compatible classes (e.g. in module composition or testing)

Explanation

UnboundMethod represents a method definition independent of any particular object; binding it to a new (compatible) receiver allows reusing method implementations across otherwise unrelated class hierarchies in advanced metaprogramming scenarios.

Progress
99/100