Topic: best way to modify a gem's behavior?

rack-contrib is a gem with many Rack middleware and utilities, one such middleware is Rack::StaticCache. I'd like to modify one of the methods,

Re: best way to modify a gem's behavior?

Weird - my post was truncated at the point where i used double quotes. Here's what I tried to post w/ double quotes removed:

rack-contrib is a gem with many Rack middleware and utilities, one such middleware is Rack::StaticCache. I'd like to modify one of the methods, mymethod, implemented by this StaticCache class below. What's the right way to go about doing this?

module Rack
class StaticCache
def mymethod
modified-code-goes-here
end

Thanks for the help in advance!

Re: best way to modify a gem's behavior?

Since I just went through this myself, and thrashed around a few different ways, and did a bunch of research, I believe that the

Re: best way to modify a gem's behavior?

(hmmm... post truncated at the double quotes... repost w/o doublequotes...)

Since I just went through this myself, and thrashed around a few different ways, and did a bunch of research, I believe that the Rails way is to fork the source code on GitHub, make the changes, and then point the gem to the github source in your Gemfile.

But having said that, and I'm still convinced that it's the right way, I'm having a weird problem with Bundler when I do this.

So I wish you better success than I'm having!!

Les

Re: best way to modify a gem's behavior?

We have been trying to identify the cause of truncated posts.
Seems like you have found the problem, nice one smile. I'll pass this on to the administrators and hopefully get it looked at soon

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)