Hi, list I'm wondering what does double @ sign after __END__ syntax meaning like in this file single file sinatra app really impressed me :) : https://github.com/syohex/emacs-realtime-markdown-... -- Silence is golden. twitter: @AccelReality wikipedia: AleiPhoenix blog: weblog.areverie.org wiki: wiki.areverie.org
on 2013-11-12 09:46
on 2013-11-12 10:06
Hello, On 12 Νοε 2013, at 09:44 , AR (aka AleiPhoenix) <email@example.com> wrote: > Hi, list > > I'm wondering what does double @ sign after __END__ syntax meaning like in this file 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: firstname.lastname@example.org URL: http://www.convalesco.org GnuPG ID: 0x1A7BFEC5 gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
on 2013-11-12 12:23
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.