Write Out Then Read In Hash of Two-element Arrays

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, 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

···

--
Posted via http://www.ruby-forum.com/\.