End of Yaml

M

Marc Heiler

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?
 
E

Eustáquio 'TaQ' Rangel

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,
 
R

Ryan Davis

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
 
C

Charles Oliver Nutter

Michael said:
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
 
R

Ryan Davis

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,053
Members
47,656
Latest member
rickwatson

Latest Threads

Top