Comments on: 11 Ruby Tricks You Haven’t Seen Before http://www.blackbytes.info/2016/01/ruby-tricks/ Ruby Programming Tutorials Fri, 07 Oct 2016 13:37:59 +0000 hourly 1 http://wordpress.org/?v=4.3.6 By: Jesus Castello http://www.blackbytes.info/2016/01/ruby-tricks/#comment-455 Fri, 22 Jan 2016 13:17:31 +0000 http://www.blackbytes.info/?p=2491#comment-455 Thank you :)

]]>
By: Steve Shreeve http://www.blackbytes.info/2016/01/ruby-tricks/#comment-454 Fri, 22 Jan 2016 06:03:40 +0000 http://www.blackbytes.info/?p=2491#comment-454 Here’s another one for your list… a little gem which uses Fiddle to access an otherwise internal-only part of Ruby itself to access the bindings of any caller of a function. If a calls b, which calls c, which calls d… then the ‘bindings’ gem will allow the d method to access variables defined in c, b, or a. The code is tiny and has been extremely helpful for us!

Check it out at: https://github.com/shreeve/bindings

]]>
By: Jesus Castello http://www.blackbytes.info/2016/01/ruby-tricks/#comment-451 Thu, 21 Jan 2016 19:38:19 +0000 http://www.blackbytes.info/?p=2491#comment-451 You’re right. I have corrected the problem, thanks for letting us know.

]]>
By: MadBomber http://www.blackbytes.info/2016/01/ruby-tricks/#comment-450 Thu, 21 Jan 2016 18:54:12 +0000 http://www.blackbytes.info/?p=2491#comment-450 Trick #3 incorrectly states “This will generate an array with 10 random numbers which are between 0 and 300.”

Actually rand(max) generates a number less than max: 0 <= n < max

http://ruby-doc.org/core-2.3.0_preview1/Random.html#method-i-rand

]]>
By: Jesus Castello http://www.blackbytes.info/2016/01/ruby-tricks/#comment-449 Thu, 21 Jan 2016 18:49:06 +0000 http://www.blackbytes.info/?p=2491#comment-449 This is a thing because case statements use ===.
You can read more about that in this post.

]]>