Skip to content

Instantly share code, notes, and snippets.

@k-rudy
Created May 12, 2015 20:18
Show Gist options
  • Select an option

  • Save k-rudy/1f4596fd3029e79b1550 to your computer and use it in GitHub Desktop.

Select an option

Save k-rudy/1f4596fd3029e79b1550 to your computer and use it in GitHub Desktop.
Monkey patching demo
require 'redis'
class Redis
module Connection
class Ruby
def self.restus
puts 'non overriden'
end
def self.connect(config)
puts 'non overriden'
end
end
end
end
class Redis
module Connection
class Ruby
def self.connect(config)
puts 'the method is overriden'
end
end
end
end
Redis::Connection::Ruby.restus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment