Skip to content

Instantly share code, notes, and snippets.

@timlinquist
Created April 21, 2011 19:01
Show Gist options
  • Select an option

  • Save timlinquist/935252 to your computer and use it in GitHub Desktop.

Select an option

Save timlinquist/935252 to your computer and use it in GitHub Desktop.
Monkey patching examples
Inheritance
app/models/page.rb L 89 def clone...
(lib | lib/patches)/productize.rb L 62 def clone_with_nil_timestamps....
Composition
app/controllers/balances.rb L 209 def balances_by_industry......
vendor/plugins/to_csv.rb
DIP (Dependency Injection Principle)
lib/patches/extend_client_actions_and_helpers.rb
Anyone have good examples???
Delegation
Design with extensibility in mind
References:
http://avdi.org/devblog/2008/03/25/sustainable-development-in-ruby-introduction/
The Wikis - http://en.wikipedia.org/wiki/Monkey_patch
Google - monkey patching in ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment