ruby - self.included in a module -
i have class brand includes module simpleurlsanitizer. module has class method defined below:
class brand include simpleurlsanitizer end module simpleurlsanitizer def self.included base base.send :extend, self end end since including module, have access module's instance methods. class method included called when module included in class. base brand class. included method doing? self inside method referring module or brand class? how work?
as you're including simpleurlsanitizer in class, methods of simpleurlsanitizer accessible instance method. default behavior.
the included part making sure that, can access methods class methods.
Comments
Post a Comment