Forum: Ruby module inheritance

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Charlie B. (Guest)
on 2006-04-12 19:05
(Received via mailing list)
I'm trying to modify a module but I can't seem to access it's private
functions.  This is for a rails app but I can't find the help I'm
looking for on the rails list and it's more of a ruby question than a
rails question.  I'll list my code and then the error.

module ActionController::Caching::Pages
  include ClassMethods
  # Expires the page that was cached with the +path+ as a key. Example:
expire_page "/lists/show"
  def expire_each_page(path)
    return unless perform_caching
    logger.error("EXPIRED ALL PAGES: #{path}")
    File.delete(page_cache_path(path)) if
    Dir.foreach(page_cache_path(path)) {|x| benchmark ("Got " + x) }

    def page_cache_file(path)
      name = ((path.empty? || path == "/") ? "/index" :
      name << page_cache_extension unless (name.split('/').last ||
name).include? '.'
      return name

    def page_cache_path(path)
      page_cache_directory + page_cache_file(path)


The two private methods are copied directly out of the file I'm trying
to modify.  I don't want to copy these methods into my plugin.  If I
leave out the private methods, rails quits and complains about not being
able to find these methods.  I just want to inherit them.  Can you
inherit private methods?  The file I'm trying to inherit from can be
viewed at.

Thanks in advance for any help!

Charlie B.
This topic is locked and can not be replied to.