# Module inheritance

**URL:** <https://www.ruby-forum.com/t/module-inheritance/57633>\
**Category:** Ruby\
**Created:** [April 12, 2006, 5:05pm UTC](https://www.ruby-forum.com/t/module-inheritance/57633 "2006-04-12T17:05:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [April 12, 2006, 5:05pm UTC](https://www.ruby-forum.com/t/module-inheritance/57633/1 "2006-04-12T17:05:53Z")

</div>

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](http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/caching.rb)

Thanks in advance for any help!

Charlie B.  
[www.recentrambles.com](http://www.recentrambles.com)
