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 [...]
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. [...]
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 [...]
August 6 2010 by
Ryan Carter in
Rails,
Ruby |
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 %>
August 6 2010 by
Ryan Carter in
Rails,
Ruby |
Time.now is a ruby function to display the current time. The
July 26 2010 by
Ryan Carter in
Ruby |
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.
July 26 2010 by
Ryan Carter in
Ruby |
To convert a number to a string in Ruby, do this: 40.to_s
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. [...]