From: dare ruby Date: 2008-02-08T12:45:21+09:00 Subject: Re: How to add string objects to hash? Dear every one, The following code is a sample code i tried to work out my task. class Sample def initialize @test = String.new end def calculate! if @character == 'C' string_manipulate! end end def string_manipulate while @character != 'A' @character = read_character! # method to read character from buffer @test << @character end if @character == 'A' calculate! else end @test end end I need to write a method now to retrieve @test string from string_manipulate method and store in a hash. Each time a @test string is returned it should be stored in a hash not in an array. I have used array to store it but now my task need to do it using hash. so could anyone help me out to write a method to retrieve string objects using a hash. Thanks in advance...... Regards, Jose Martin -- Posted via http://www.ruby-forum.com/.