YAML questions/ideas

Hi, _why (and others who may wish to comment)...

I'm pausing from doing the hamster dance long enough to
say thanks for YAML in Ruby first of all, and second of
all to ask a couple of questions.

1. Are there plans to call #initialize_copy as we once
talked about? See my post of last week, referring to a
still older one.

2. I sometimes wish for a little less line-orientation in
YAML. Is this contrary to the spirit of YAML?

I know (and like) the "inline" arrays and hashes and such.

But when values are short enough, sometimes I'd like to put
(at least some of) them on single lines.

E.g. instead of:

   - !ruby/object:SomeClass
     foo: 23
     bar: 37
     bam: 237

I'd like:

   - !ruby/object:SomeClass; foo: 23; bar: 37; bam: 237

or the equivalent.

Would this ever be possible?

Cheers,
Hal

Hi,

Hal Fulton <hal9000@hypermetrics.com> writes:

But when values are short enough, sometimes I'd like to put
(at least some of) them on single lines.

E.g. instead of:

   - !ruby/object:SomeClass
     foo: 23
     bar: 37
     bam: 237

I'd like:

   - !ruby/object:SomeClass; foo: 23; bar: 37; bam: 237

or the equivalent.

Would this ever be possible?

- !ruby/object:SomeClass { foo: 23, bar: 37, bam: 237 }

···

--
eban

1. Are there plans to call #initialize_copy as we once
talked about? See my post of last week, referring to a
still older one.

Yes. Very soon.

2. I sometimes wish for a little less line-orientation in
YAML. Is this contrary to the spirit of YAML? ...

I'd like:

  - !ruby/object:SomeClass; foo: 23; bar: 37; bam: 237

or the equivalent.

Syck is pretty flexible about the "inline" collections. Just make sure
that some degree of indentation is respected as you use these and they
can be nested and all that.

Valid:

- !ruby/object:SomeClass {foo: 23, bar: 37,
     bam: 237, kablooey: [8, 8, 8], bazzuumka: 990}

Invalid:

- !ruby/object:SomeClass {foo:23,
bar: 37, bam: 237, kablooey: 888,
bazzuumka: 990}

_why

···

Hal Fulton (hal9000@hypermetrics.com) wrote:

WATANABE Hirofumi wrote:

Would this ever be possible?

- !ruby/object:SomeClass { foo: 23, bar: 37, bam: 237 }

Arigato!

Hal

why the lucky stiff wrote:

Syck is pretty flexible about the "inline" collections. Just make sure
that some degree of indentation is respected as you use these and they
can be nested and all that.

Valid:

- !ruby/object:SomeClass {foo: 23, bar: 37,
     bam: 237, kablooey: [8, 8, 8], bazzuumka: 990}

Invalid:

- !ruby/object:SomeClass {foo:23,
bar: 37, bam: 237, kablooey: 888,
bazzuumka: 990}

Ahh, cool, cool. Thanks!

This works nicely. I must have messed up the indentation the last time
I tried this.

Merci beaucoups, and keep up the good work.

Hal