christine · @christine
269 followers · 255 posts · Server ruby.social

Halp, I think has me in a hostage situation. Serves me right for attempting to do another active record query when I hit an exception

#byebug

Last updated 2 years ago

GenghisKen Coar · @GenghisKen
47 followers · 157 posts · Server ruby.social

Weirdness trying to modify 's default method. If I don't have an method in my , I get the usual

"#<𝚌𝚕𝚊𝚜𝚜𝚗𝚊𝚖𝚎:𝚒𝚗𝚜𝚝𝚊𝚗𝚌𝚎 @𝚒𝚟𝚊𝚛=𝚟𝚊𝚕𝚞𝚎, @𝚘𝚝𝚑𝚎𝚛_𝚒𝚟𝚊𝚛=𝚟𝚊𝚕𝚞𝚎>"

But if I define one like this,

def inspect
defval = super
return defval
end

what I get is

"#<𝚌𝚕𝚊𝚜𝚜𝚗𝚊𝚖𝚎:𝚒𝚗𝚜𝚝𝚊𝚗𝚌𝚎 ...>"

And I get anomalous results in the debugger, defval gets the above result. But if I enter "defval = super" by hand in the debugger, I get the original default output from 𝚒𝚗𝚜𝚙𝚎𝚌𝚝. ?

#ruby #inspect #class #byebug

Last updated 3 years ago

James Adam · @james
2554 followers · 879 posts · Server ruby.social

When debugging , I always struggled to get to enter the contents of a block, painstakingly stepping through internal methods and watching out for the yield. If you've ever debugged and/or callbacks, you'll know this pain.

Today, I learned you can just type `c <line number>` to jump straight into the block while skipping all of the plumbing that yields to it.

:ruby: 🐜 🚫 👍

#ruby #byebug #rails

Last updated 7 years ago