Last Updated: February 25, 2016
·
474
· pierrel

Quick Enumerable Inspection

Some enumerables aren't easily inspectable:

>> conn.execute("SELECT * from projects LIMIT 3").inspect
=> "#<PGresult:0xa8ccdf0>"

If you want to see what's inside just map without any arguments:

>> conn.execute("SELECT * from projects LIMIT 3").map
=> [{"deleted_at"=>nil, "id"=>"123", "created_at"=>"2007-04-09 13:15:03.173735", "updated_at"=>"2008-02-13 22:30:42.950915"}, {"deleted_at"=>nil, "id"=>"321", "created_at"=>"2007-04-09 12:49:38.427811", "updated_at"=>"2008-02-13 22:30:43.738916"}, {"deleted_at"=>"2007-02-01 23:00:13", "id"=>"34159", "created_at"=>"2007-01-18 18:49:47", "updated_at"=>"2007-01-18 18:49:47"}]