Module: MethodLogging

Included in:
ImportEverything::SqlInsertParser::LineParser
Defined in:
lib/import_everything/ext.rb

Instance Method Summary collapse

Instance Method Details

#def_logging_method(name, &b) ⇒ Object



26
27
28
29
30
# File 'lib/import_everything/ext.rb', line 26

def def_logging_method(name,&b)
  define_method(name) do |*args|
    res = instance_eval()
  end
end

#log_method(name) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/import_everything/ext.rb', line 18

def log_method(name)
  alias_method "unlogged_#{name}", name
  define_method(name) do |*args|
    res = send("unlogged_#{name}",*args)
    puts "#{name} returned #{res.inspect} from #{args.inspect}"
    res
  end
end