Calling Ruby module methods from a nested class within -


Is there a way to call module method from a nested class? Code:

  module group sweeper def expire_cache (path) paths.each do | Path | Expire_page (path) end-end class sweeper & lt; ActionController :: Caching :: Sweeper Group S Weper is included in the topic def after_save (topic) expire_cache ([root_path, subjects_path]) End DF after_destroy (topic) expire_cache ([root_path, subjects_path] end end   

  • The group defines a nested class sweeper forest on the scale
  • The sweeper group is included in the groupifier

    This will not work.

    To answer your Ruby method / nested class question:

      Module MyModule def my_method puts "yo yo yo" and class MySweetClass def sweet_method "swweeeeeeeeeeeeeet" and End End   

    and you want to call mySweetClass's sweet_method, you can change:

      module MyModule def My_method "yo yo yo "MySweetClass.new.sweet_method puts the end class MySweetClass def sweet_method" swweeeeeeeeeeeeeet "puts end end end #. The class MyClass MyModule end MyClass.new.my_method   

    however included! I think that you are on the wrong track about rail submarines. The answer is very tactical, but I think that you should open a question about what you are trying to do about railway submarines.

Comments