Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another neat IRB trick is to put a useful expression after the semicolon, like in your case s.length. This is especially useful on, say, the Rails console.

Also keep in mind that Ruby can evaluate lots of different expressions, so if say you calculated a number "n" and expect that there are "n" records that meet a given query, you can go:

    stuff = SomeModel.somescope; stuff.size == n
and Ruby will just say "true" or "false".


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: