Skip to content

Instantly share code, notes, and snippets.

View matsumonkie's full-sized avatar

iori matsumonkie

View GitHub Profile
@matsumonkie
matsumonkie / virtual_proxy.rb
Created June 4, 2014 22:07
ruby - virtual proxy pattern
class VirtualProxy < BasicObject
def initialize(&loader)
@loader = loader
@object = nil
end
def method_missing(name, *args, &block)
__load__
@object.public_send(name, *args, &block)
end