2009/3/24 Daniel Dale <dochappy / gmail.com>:
> thanks again . I'll look into those links about YAML
>
> here's what I got so far. the input works correctly but I still can't
> get it to save the info that I input into a file
>
> class Game
>  def
> initialize(title,platform,genre,rating,published_by,developed_by,year,condition)
>      @title=title
>      @platform=platform
>      @genre=genre
>      @rating=rating
>      @published_by=published_by
>      @developed_by=developed_by
>      @year=year
>      @condition=condition
>      @my_file= File.new("C:\ruby\gamesdb.txt",'a+')
> end
>
>
> puts "Enter the name of the game:"
> @title = gets
> @title.to_s
>
>
> puts "Enter the platform:"
> @platform = gets
> @platform.to_s
>
>
> puts "Enter the genre:"
> @genre = gets
> @genre.to_s
>
> puts "Enter Rating:"
> @rating=gets
> @rating.to_s
>
> puts "Published by:"
> @published_by = gets
> @published_by.to_s
>
> puts "Developed by:"
> @developed_by= gets
> @developed_by.to_s
>
> puts "What Year was it released?:"
> @year= gets
> @year.to_s
>
> puts "What condition is it in?:"
> @condition= gets
> @condition.to_s
>
> def to_s
>     puts
> "Games:#{@title}--#{@platform}--#{@genre}--#{@rating}--#{@published_by}--#{@developed_by}--#{@year}--#{@condition}"
>   end
>  def savedata
>    @my_file.puts
> "Games:#{@title}--#{@platform}--#{@genre}--#{@rating}--#{@published_by}--#{@developed_by}--#{@year}--#{@condition}"
>  end
>  def printdata
>    file = File.open("C:\ruby\gamesdb.txt")
>    file.each {|info| print info}
>  end
>
> end
> --
The pathname "C:\ruby\gamesdb.txt" should be
"C:\\ruby\\gamesdb.txt" or "C:/ruby/gamesdb.txt"

Regards,

Park Heesob