Ok, I have a gem rail I'm working on, and I want it to override a specific method in chains.
The method I want to override is: Sprockets :: Base.digest so that I can print the fingerprint from my version of gem when compiling the application.
How can i do this?
In my gem, I create the lib / sprockets / base.rb file and place the following code:
class Sprockets :: Base
def digest
@digest = digest_class.new.update (MyGem :: VERSION)
@ digest.dup
end
end
When I run bundle exec rake assets:precompile , I get:
undefined method 'logger=' for #<Sprockets::Environment:0x1315b040>
It seems to me that the whole class is redefined in some way (this will lose this and other methods) instead of just redefining one method.
If I include this piece of code directly in the rakefile of an application that uses both stones, everything works fine.
override ruby ruby-on-rails ruby-on-rails-3 gem
ifightcrime Jan 05 '12 at 1:22 2012-01-05 01:22
source share