Forum: Ruby module inheritance

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-04-12 17: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
File.exists?(page_cache_path(path))
    Dir.foreach(page_cache_path(path)) {|x| benchmark ("Got " + x) }
    rescue
  end

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

    def page_cache_path(path)
      page_cache_directory + page_cache_file(path)
    end

end

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.
http://dev.rubyonrails.org/browser/trunk/actionpac...

Thanks in advance for any help!

Charlie Bowman
www.recentrambles.com
This topic is locked and can not be replied to.