Put this in your code to debug anything

Aaron Patterson wrote a very nice article on how he does deubgging.

Here is some more code to make your debugging easier.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

class Object
def dbg
self.tap do |x|
puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
puts x
puts "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
end
end
end

# now you can turn the following:
get_csv.find{|x| x[id_column] == row_id}

# into =>
get_csv.dbg.find{|x| x[id_column.dbg] == row_id.dbg}.dbg

Update:

Josh Cheek has taken this to the 11th level here: https://gist.github.com/JoshCheek/55b53e2faa2776d6a054#file-ss-png Awesome stuff :)


I am currently working on LiveForm which makes setting up contact forms on your website a breeze.