Q. What is the primary difference between module_function and extend self in Ruby?
-
(A)
module_function makes the specified methods accessible as module methods, while extend self makes them accessible as instance methods
-
(B)
module_function makes the specified methods private, while extend self makes them public
-
(C)
module_function creates a new module, while extend self extends the current module
-
(D)
module_function makes the specified methods singleton methods, while extend self makes them instance methods
β
Correct Answer: (A)
module_function makes the specified methods accessible as module methods, while extend self makes them accessible as instance methods