Forum: Ruby What's does this double @ sign syntax mean after __END__

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
AR (aka AleiPhoenix) (Guest)
on 2013-11-12 09:46
(Received via mailing list)
Hi, list

I'm wondering what does double @ sign after __END__ syntax meaning like
in
this file[1]

single file sinatra app really impressed me :)

[1]:
https://github.com/syohex/emacs-realtime-markdown-...

--
Silence is golden.

twitter: @AccelReality
wikipedia: AleiPhoenix
blog: weblog.areverie.org
wiki: wiki.areverie.org
Panagiotis Atmatzidis (Guest)
on 2013-11-12 10:06
(Received via mailing list)
Hello,

On 12 Νοε 2013, at 09:44 , AR (aka AleiPhoenix) <aleiphoenix@gmail.com>
wrote:

> Hi, list
>
> I'm wondering what does double @ sign after __END__ syntax meaning like in this
file[1]


Generally speaking it's a class variable.

In this context (sinatra classic) @@index marks  the index HTML page
structure in 'erb' (note line 12.. erb :index) which you will see when
you access the 'index.html' page.

> blog: weblog.areverie.org
> wiki: wiki.areverie.org
>


Panagiotis (atmosx) Atmatzidis

email:  atma@convalesco.org
URL:  http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
B90e62c813e769264dc8869a26678b77?d=identicon&s=25 Xavier N. (fxn)
on 2013-11-12 12:23
(Received via mailing list)
Sinatra does a little bit of magic there.

You probably know that in Ruby the content after an __END__ token is
available via the DATA filehandle... as long as you are in the main file
passed to Ruby to execute.

Sinatra extends this idea to other files to offer inline templates,
processing __END__ by hand:


https://github.com/sinatra/sinatra/blob/master/lib...

Then, it evaluates the text accordingly.
This topic is locked and can not be replied to.