Ruby General
How to remove any non-alpha characters (a to z) from a string using gsub and RegEx
12/05/14 Public, Tricks, Ruby General
For example, let's say that you have a method that determines if a particular word (string) is a palindrome or not. As a fringe case, what if the string happens to contain characters like . or...
1 vote - harrylevine
How to require and re-load a Ruby file during an IRB session
11/24/14 Public, Command Line, Ruby General
This is so you can upload some existing classes and/or methods that you have written in a file, during an IRB session.
$ irb
1 vote - harrylevine
11/07/14 Public, Tricks, Ruby General
To take an array like:
[1, 3, 'two', 5]
and have it result in an array of pairs such as:
[[1, 3], 'two', 5]]
You can use each_slice method.
array.each_slice(2)
Provided, of course, that array is assigned the original ...
2 votes - kotp