Class: HomeFS::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/homefs/debug.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Wrapper

Returns a new instance of Wrapper.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/homefs/debug.rb', line 3

def initialize(object)
    methods = (object.class.instance_methods -
               Object.instance_methods)
    methods.each do |method|
        self.define_singleton_method(method) do |*args|
            warn "#{method} called with args #{args.inspect}"
            begin
                ret = object.send(method, *args)
                warn "\tMethod returned #{ret.inspect}"
                return ret
            rescue SystemCallError => e
                warn e
                raise e
            rescue Exception => e
                warn e
                warn e.backtrace
                raise e
            end
        end
    end
end