Robert

I was at a ruby meetup this morning where the speaker was going over a
tutorial on testing. Through the refactoring steps it was serendipitous
much like this thread. At first they used to_i and at the cleanest point of
the cycle which had the lowest token count while retaining bug/error free
code by removing any complexity and overhead ended with Integer being the
most optimum use.

I smiled and thought of this thread. I'll be using Integer more often now =)

~Stu



On Sat, Aug 17, 2013 at 4:34 AM, Robert Klemme
<shortcutter / googlemail.com>wrote:

>
>
>
> On Sat, Aug 17, 2013 at 3:28 AM, Stu <stu / rubyprogrammer.net> wrote:
>
>> Looks like you need to convert your string into an integer.
>>
>> age = gets
>> age = age.to_i
>>
>> that should work.
>>
>
> OP may also want to do
>
> age = Integer(gets)
>
> This gives feedback if the entered string was not an valid integer number
> representation.
>
> Kind regards
>
> robert
>
> --
> remember.guy do |as, often| as.you_can - without end
> http://blog.rubybestpractices.com/
>