Forum: Ruby Re: Write Out Then Read In Hash of Two-element Arrays

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6087a044557d6b59ab52e7dd20f94da8?d=identicon&s=25 Peña, Botp (Guest)
on 2006-04-20 11:44
(Received via mailing list)
David Bailey wrote last Thursday, April 20, 2006 5:01 PM:
...
#   fileOut.puts(histHash[i])
                     ^^^^^
there is a problem here. consider..

irb(main):003:0> puts [10,1]
10
1
=> nil
irb(main):004:0> puts [10,1].to_s
101
=> nil

i think you wanted the latter, so

 fileOut.puts(histHash[i].to_s)

should do.

some tips:

1 try unit test
2 yaml
3 marshal

kind regards -botp
Efe70cff891d5722448a6512cfd1e1f1?d=identicon&s=25 David Bailey (dbailey7)
on 2006-04-20 20:51
Peña, Botp wrote:
> David Bailey wrote last Thursday, April 20, 2006 5:01 PM:
> ...
> #   fileOut.puts(histHash[i])
>                      ^^^^^
> there is a problem here. consider..
>
> irb(main):003:0> puts [10,1]
> 10
> 1
> => nil
> irb(main):004:0> puts [10,1].to_s
> 101
> => nil
>
> i think you wanted the latter, so
>
>  fileOut.puts(histHash[i].to_s)
>
> should do.
>
> some tips:
>
> 1 try unit test
> 2 yaml
> 3 marshal
>
> kind regards -botp

Peña,

Yes, that was what I needed.  And I will look into yaml and marshal.
Uh, how ro I find documentation about unit test?  In any case, thank you
very much.

David
This topic is locked and can not be replied to.