Skip to content

Instantly share code, notes, and snippets.

@pechorin
Created April 27, 2012 13:31
Show Gist options
  • Save pechorin/2509232 to your computer and use it in GitHub Desktop.
Save pechorin/2509232 to your computer and use it in GitHub Desktop.
lolproxy
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