Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created March 24, 2010 09:05
Show Gist options
  • Save workmad3/342108 to your computer and use it in GitHub Desktop.
Save workmad3/342108 to your computer and use it in GitHub Desktop.
require 'myclass'
traceable = MyClass.CreateTraceableObject()
require 'traceable_object'
class MyClass
def self.CreateTracableObject
obj = MyClass.new
if APP_TRACE
return TraceableObject.new(obj)
else
return obj
end
end
end
class TraceableObject
def initialize(obj)
@obj = obj
end
def before_trace
end
def after_trace
end
def method_missing(sym, *args, &block)
before_trace
@obj.send sym, *args, &block
after_trace
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment