Module inheritance


#1

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/actionpack/lib/action_controller/caching.rb

Thanks in advance for any help!

Charlie B.
www.recentrambles.com