Top "Monkeypatching" questions

Dynamically modifying run-time behavior by replacing program elements with new program elements

Monkey patching Devise (or any Rails gem)

I'm using the Devise authentication gem in my Rails project, and I want to change the keys it's using in …

ruby-on-rails ruby devise rubygems monkeypatching
How to monkey patch Django?

I came upon this post on monkey patching Django: from django.contrib.auth.models import User User.add_to_class(…

python django django-models monkeypatching
Advantages of Using MethodType in Python

What are the advantages of using MethodType from the types module? You can use it to add methods to an …

python oop methods monkeypatching
Adding a datetime stamp to Python print

I am trying to debug the behaviour of a large library I depend on, which uses a scattering (no make …

python debugging monkeypatching built-in
Monkey patch a function in a module for unit testing

I have the following method in a module that calls another method imported from another module: def imported_function(): do_…

python unit-testing monkeypatching
Where to put code when monkey patching

Everything I read about monkey patching says to do something like this: class String def foo #your special code end …

ruby-on-rails ruby monkeypatching
pytest modules using os.environ - Ho do I test it correctly?

currently I am writing some Webapp, but this time I want to learn how to write proper tests for it (…

python environment-variables pytest monkeypatching
Recommended approach to monkey patching a class in ruby

I've noticed that there are two common ways to monkey patch a class in ruby: Define the new members on …

ruby monkeypatching
How to monkey-patch code that gets auto-loaded in Rails?

I'm monkey-patching a Rails engine with something like: SomeClass.class_eval do # ... end The first time I hit the web …

ruby-on-rails monkeypatching ruby-on-rails-2
monkey patching in php

I'm trying to figure out how monkey patching works and how I can make it work on my own objects/…

php monkeypatching