class BaseClass def hello :hello end end base_object = BaseClass.new base_object.hello class InheritClass < BaseClass end inherit_object = InheritClass.new inherit_object.hello def base_object.hello :singleton_method_hello end base_object.hello module HelloModule def hello_from_module :hello_from_module end end class InheritClass include HelloModule end inherit_object = InheritClass.new inherit_object.hello_from_module module ByeModule end class MixinClass < BaseClass include HelloModule include ByeModule end class DuplicateMixinClass < BaseClass include HelloModule include ByeModule include HelloModule end inherit_object = InheritClass.new inherit_object.net_exist_method module HelloModule def hello :hello_module end end class GrandParentClass def hello :grand_parent_hello end end class ParentClass < GrandParentClass include HelloModule end class ChildClass < ParentClass end child = ChildClass.new child.hello module PrependModule def prepended_method :prepended_method end end class PrependedClass prepend PrependModule end prepended_obj = PrependedClass.new prepended_obj.prepended_method module IncludeModule def embeded_method :from_include_module end end module PrependModule def embeded_method :from_prepend_module end end class EmbeddedClass include IncludeModule prepend PrependModule end embeded_obj = EmbeddedClass.new embeded_obj.embeded_method class ReverseEmbeddedClass prepend PrependModule include IncludeModule end reverse_embeded_obj = ReverseEmbeddedClass.new reverse_embeded_obj.embeded_method class PrependedClass prepend PrependModule def embeded_method :prepended_class end end obj = PrependedClass.new obj.embeded_method module SuperCallModule def super_call_method puts "super_call_method" super end end class OverrideClass prepend SuperCallModule def super_call_method :overrode end end override_obj = OverrideClass.new override_obj.super_call_method module BeforeHelloFilter def hello "Hi! " + super end end class Hello prepend BeforeHelloFilter def hello "hello" end end Hello.new.hello module FirstPrependModule def prepended_method :first_prepend_module end end module SecondPrependModule def prepended_method :second_prepend_method end end class PrependedClass prepend FirstPrependModule prepend SecondPrependModule end prepended_obj = PrependedClass.new prepended_obj.prepended_method