Hi
I've just started playing with YAML but am having problems saveing the file. What I can work out from the docs is that I should use something like:-
require 'yaml'
y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
however when I do this in irb I get
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
NoMethodError: undefined method `Store' for YAML:Module
from (irb):2
irb(main):003:0>
Anyone know what I'm doing wrong.
Cheers
Nigel
Hi
I've just started playing with YAML but am having problems saveing the
file. What I can work out from the docs is that I should use something
like:-
require 'yaml'
y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator =>
'---.pstore' )
however when I do this in irb I get
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> y = YAML.Store.new( "./yaml.store.1", :Indent => 2,
:Separator => '---.pstore' )
NoMethodError: undefined method `Store' for YAML:Module
from (irb):2
irb(main):003:0>
Anyone know what I'm doing wrong.
This is what I usually use:
File.open('filename', 'w+b') {|file| YAML.dump my_data, file}
Cheers
Nigel
E
···
Le 6/6/2005, "Nigel Wilkinson" <nigel@waspz.co.uk> a écrit:
--
template<typename duck>
void quack(duck& d) { d.quack(); }
YAML::Store
^^
you are trying to call the 'Store' method of the YAML module with 'YAML.Store'
cheers.
-a
···
On Tue, 7 Jun 2005, Nigel Wilkinson wrote:
Hi
I've just started playing with YAML but am having problems saveing the file. What I can work out from the docs is that I should use something like:-
require 'yaml'
y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
however when I do this in irb I get
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
NoMethodError: undefined method `Store' for YAML:Module
from (irb):2
irb(main):003:0>
Anyone know what I'm doing wrong.
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso
===============================================================================
YAML::Store
. signifies calling a method.
···
On 06 Jun 2005, at 14:33, Nigel Wilkinson wrote:
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> y = YAML.Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
NoMethodError: undefined method `Store' for YAML:Module
from (irb):2
irb(main):003:0>
Anyone know what I'm doing wrong.
--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
Thanks, that seems to do what I want.
With ref to the other solution for some reason I still get
irb(main):051:0* require 'yaml'
=> false
irb(main):052:0> y = YAML::Store.new( "./yaml.store.1", :Indent => 2, :Separator => '---.pstore' )
NameError: uninitialized constant YAML::Store
from (irb):52
irb(main):053:0>
But I have a result that works
Cheers
Nigel
···
--On Tuesday, June 07, 2005 07:08:17 +0900 ES <ruby-ml@magical-cat.org> wrote:
This is what I usually use:
File.open('filename', 'w+b') {|file| YAML.dump my_data, file}
E