When building collections of data you will find situations where the types aren’t what you planned to work with. And when I say types I’m speaking generically of arrays, hashes, strings, integers, nil, etc. Everything’s cosy when you know what your getting. For example putting 10 integers into an Array:
|
arr = [] 10.times do |num| arr << num end arr # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
But if you want…
Continue Reading »