[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

End of Yaml

Marc Heiler

8/16/2008 1:41:00 PM

Is there a way to have something like this in a yaml file:


foo: bar
__ STOP TREATING IT AS YAML FILE FROM HERE __
\²\²\24²¼ljk
asdjladskasd
some noise is here and there
asdiasdiodas
KJLljkq @@@@j� pqwjpqowj qewopjewqpjewqpjwqp728879241421ü*24242
__ END OF YAML FILE __


In other words, have a file that is a yaml file in the beginning and
then from a keyword or similar, to treat it as a "special" file with
arbitrary data, i.e. no matter if one puts images into it or something?
--
Posted via http://www.ruby-....

4 Answers

Eustaquio 'TaQ' Rangel

8/16/2008 2:10:00 PM

0

Marc Heiler wrote:

Man, I thought something terrible happened with YAML, with this kind of subject. :-)

> Is there a way to have something like this in a yaml file:

Comment the lines is an option?

foo: bar
# __ STOP TREATING IT AS YAML FILE FROM HERE __
# \²\²\24²¼ljk
# asdjladskasd
# some noise is here and there
# asdiasdiodas
# KJLljkq @@@@j� pqwjpqowj qewopjewqpjewqpjwqp728879241421ü*24242
# __ END OF YAML FILE __

Best regards,

Ryan Davis

8/18/2008 5:12:00 AM

0


On Aug 16, 2008, at 06:40 , Marc Heiler wrote:

> Is there a way to have something like this in a yaml file:
>
>
> foo: bar
> __ STOP TREATING IT AS YAML FILE FROM HERE __
> \=B2\=B2\24=B2=BCljk
> asdjladskasd
> some noise is here and there
> asdiasdiodas
> KJLljkq @@@@j=80 pqwjpqowj qewopjewqpjewqpjwqp728879241421=FC*24242
> __ END OF YAML FILE __

No, but you can do the opposite:

ruby_code
__END__
yaml

and access that with DATA.read


Charles Oliver Nutter

8/18/2008 7:33:00 AM

0

Michael T. Richter wrote:
> This whole __END__/DATA thing *does not work as expected*. It's yet
> another situation where "principle of least surprise" doesn't work at
> all in Ruby. Consider:

DATA is only provided for the file immediately executed on the command
line. You read from DATA twice, so the second read is at EOF and returns "".

- Charlie

Ryan Davis

8/19/2008 11:49:00 PM

0


On Aug 17, 2008, at 22:43 , Michael T. Richter wrote:

> This whole __END__/DATA thing does not work as expected.

correction: doesn't work as YOU expected... As said many times before
POLS is relative to Matz, not you or anyone else.

Thank you very much for thread hijacking, but I don't find anything
you're saying relevant to OP's original problem. I've seen you rant
left and right before. I don't think it has a place on #ruby-talk.