[#404611] Looking for Rubyists interested in P2P and privacy — Tony Arcieri <tony.arcieri@...>
Hey there, excuse the spam ;) Hopefully this is relevant enough.
3 messages
2013/08/07
[#409331] Capture HTML table data, pass to Ruby, pass back and display result in HTML text field — Hubert Wagner <lists@...>
Hello :
11 messages
2013/08/04
[#409339] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hubert Wagner <lists@...>
2013/08/04
Hello Jesus :
[#409340] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 9:18 AM, Hubert Wagner <lists@ruby-forum.com> wrote:
[#409346] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hubert Wagner <lists@...>
2013/08/04
Thank you all for your assistance (and patience).
[#409336] Rakefile Error - Please Help — "Jennifer T." <lists@...>
Hi,
13 messages
2013/08/04
[#409341] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 7:41 AM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409349] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117692:
[#409350] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 1:42 PM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409351] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117715:
[#409356] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 2:21 PM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409357] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117723:
[#409358] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/05
On Sun, Aug 4, 2013 at 4:57 PM, Jennifer T. <lists@ruby-forum.com> wrote:
Re: Saving with yaml
From:
Josh Cheek <josh.cheek@...>
Date:
2013-08-06 18:17:45 UTC
List:
ruby-talk #404605
On Tue, Aug 6, 2013 at 10:41 AM, Green Eco <lists@ruby-forum.com> wrote:
> Hi,
>
> I have a question. :-) I have already found a lot in the web but that
> does not really helped me. This far my code looks like this:
>
>
> to save:
>
> require "yaml"
>
> @characters = ["Molly", "Trade"]
> @saves = {location: "Southeaster",
> hunger: 10,
> life: 76
> }
> @settings = {display: "1360*960",
> render: "high",
> saves: "manual"
> }
>
> output = File.new("Saves.yaml", "w") do |file|
> YAML.dump
> end
> output.write YAML.dump(@characters) # Wie sichert man mehrere
> Sachen??????
> output.close
>
>
> and to load:
>
> require "yaml"
>
> output = File.new("Saves.yaml", "r")
> p YAML.load(output.read)
> output.close
>
> How can I save multiple array etc.?
>
> It works but I want to save more than one hash, I want to save e.g. all
> of them, but with that I can save just one or if I manage it to save all
> three I can just load the first one.
> So it would be nice if someone could help me. :-) Thanks
>
> Yours faithfully
> Greeneco
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> ruby-talk mailing list
> ruby-talk@ruby-lang.org
> http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-talk
>
I'd probably just put them all in the same hash:
require "yaml"
filename = "data.yaml"
characters = ["Molly", "Trade"]
saves = {location: "Southeaster", hunger: 10, life: 76}
settings = {display: "1360*960", render: "high", saves: "manual"}
program_data = {characters: characters, saves: saves, settings: settings}
# File.write may not be in some older versions of Ruby
File.write filename, YAML.dump(program_data)
loaded_data = YAML.load(File.read filename)
require 'pp'
pp loaded_data
# >> {:characters=>["Molly", "Trade"],
# >> :saves=>{:location=>"Southeaster", :hunger=>10, :life=>76},
# >> :settings=>{:display=>"1360*960", :render=>"high", :saves=>"manual"}}
_______________________________________________
ruby-talk mailing list
ruby-talk@ruby-lang.org
http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-talk