Pik: can’t dup NilClass

There is a way to install multiple versions of Ruby on Windows, just like the famed RVM for Linux. It is called Pik. A fantastic piece of software, yet I got some “There was an error. Error: can’t dup NilClass” messages while trying to use it at first. To avoid that, and fix it if [...]

Ruby: Address is already in use

If you’ve been WEBrick-rolled by Ruby’s WEBrick server, it is stuck and you can’t CTRL+C out of it, here is what you do — on a Linux system (I’m using Ubuntu): 1 ps aux | grep ruby You’ll get back a response like this: 2 3 # Never gunna give you up…haha, I got you. [...]

Ruby: No such file to load

If you are trying to run ruby, and you get some wacked out error saying something about “No such file to load” here is what you do: Open up a terminal window (usually in Accessories, then Terminal on Ubuntu systems) Then type this, hitting enter after each line and waiting for it to return with [...]

Ruby: For loop

Could it be any simpler? This is FOR-ing through a collection, array, hash, zoo, snorkel, what have you. <% for book in books %> <%= book %> <% end %>

Ruby: Embedded Ruby (ERb)

Time.now is a ruby function to display the current time. The

Ruby: Convert to Integer

To convert a string or other object into an integer (number) do this: "23".to_i This will produce 23 (as a number) If you do something like this: "Hello".to_i You will get 0 returned, because Ruby can’t understand that object and translate it into a number.

Ruby: Convert to String

To convert a number to a string in Ruby, do this: 40.to_s

RubyNoob: The Genesis

Ruby Logo by hongiiv Today I am starting to learn Ruby, and that so I can next learn Ruby on Rails. I have flirted with the RoR language, been a long-time fan, but today I become a first-time caller. I am tired of being on the outside looking into the red-tinted party in the hizouse. [...]