TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Cryptic Ruby Global Variables and Their Meanings

49 pointsby briangonzalezover 12 years ago

4 comments

telemachosover 12 years ago
For a longer list (though the explanations are briefer), see Zenspider's Ruby QuickRef[1]. It also includes a handy listing of predefined global constants[2] (and a lot more).[3]<p>[1]: <a href="http://zenspider.com/Languages/Ruby/QuickRef.html#pre-defined-variables" rel="nofollow">http://zenspider.com/Languages/Ruby/QuickRef.html#pre-define...</a><p>[2]: <a href="http://zenspider.com/Languages/Ruby/QuickRef.html#pre-defined-global-constants" rel="nofollow">http://zenspider.com/Languages/Ruby/QuickRef.html#pre-define...</a><p>[3]: <a href="http://zenspider.com/Languages/Ruby/QuickRef.html" rel="nofollow">http://zenspider.com/Languages/Ruby/QuickRef.html</a>
评论 #4531053 未加载
ef4over 12 years ago
This is one area where Matz kept too much of Perl. Thankfully, it's rare to see Ruby programmers making heavy use of these.
评论 #4531336 未加载
评论 #4532067 未加载
评论 #4531457 未加载
评论 #4531198 未加载
评论 #4531897 未加载
评论 #4531469 未加载
damncabbageover 12 years ago
When using the debugger you can sometimes end up in an exception handler that doesn't provide a way to get access to said exception. $! can be a life-saver to help figure out what's going on, eg.<p><pre><code> (rdb:1) list 11 do_something_stupid 12 rescue =&#62; 13 log("Something went wrong") 14 end (rdb:2) e $! #&#60;Errno::ENOENT: No such file or directory - /tmp/durr&#62;</code></pre>
Xylakantover 12 years ago
I rarely see those used except when you look at codegolf contests. There you can find all of those variables put to good and creative use :)