Henrik Nyh · @henrik
203 followers · 577 posts · Server ruby.social

Learned another bit of syntax I’d somehow missed – you can omit `do` in blocks, so this is fine:

- [ 1, 2, 3 ].each
p Hello #{_1}!

Not sure I like it…

#slimlang

Last updated 1 year ago

Henrik Nyh · @henrik
203 followers · 574 posts · Server ruby.social

I only learned yesterday that in , you can interpolate unescaped values with #{{ … }}.

Replacing some

javascript:
let foo = #{raw foo.to_json}

with

javascript:
let foo = #{{foo.to_json}}

Other than being shorter, it also works in which doesn’t have Rails’s HTML safety model.

(Might also explore moving some of these to data attributes or something.)

#slimlang #sinatra

Last updated 1 year ago