When programming in ruby you may have to reach for a module that has encapsulated some helper functions that you want to use in your class. To tell if the module has been included in your class you can use the
include method. Likewise, to tell if you choose to extend the module you can check that through the
Below is a working example. Notice we do not need to instantiate our classes to invoke these methods:
module SomeModule def self.included(base) p base.inspect end def self.extended(base) p base.inspect end end class IncludedClass include SomeModule end class ExtendedClass extend SomeModule end
Running this script will print:
To fill your hearts desire for more ruby programming blog posts check out this one.