Prefer Ruby Class Method or Mix-In Instance Method?

Burdette Lamar - Jun 30 '18 - - Dev Community

Assume that a certain functionality is available in Ruby both as a class method and as an instance method (via a module).

Class method:

require 'foo'  
Foo.foo()  
Enter fullscreen mode Exit fullscreen mode

Instance method (via module):

require 'bar'    
include Bar    
bar()    
Enter fullscreen mode Exit fullscreen mode

Assuming that the two methods behave identically, which would you prefer using, and why?

(Note that the question is not about which to implement, but instead about which to use if both available.)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player