Created
April 27, 2012 13:31
-
-
Save pechorin/2509232 to your computer and use it in GitHub Desktop.
lolproxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Renderer | |
def render | |
puts "RENDERED" | |
end | |
end | |
# а теперь создадим прокси :)) | |
Renderer.class_eval do | |
def proxy | |
puts "proxy called" | |
old_render | |
end | |
alias :old_render :render | |
alias :render :proxy | |
end | |
r = Renderer.new | |
r.render # => proxy called | |
# => RENDERED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment