havenwood changed the topic of #ruby to: Ruby 3.4.5, 3.3.9, 3.5.0-preview1 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
joto has quit [Read error: Connection reset by peer]
joto has joined #ruby
cappy has joined #ruby
joast has joined #ruby
itaipu has quit [Ping timeout: 260 seconds]
cherryramatisdev has quit [Quit: WeeChat 4.7.1]
itaipu has joined #ruby
itaipu has quit [Ping timeout: 258 seconds]
manveru has quit [Server closed connection]
manveru has joined #ruby
itaipu has joined #ruby
TomyWork has quit [Remote host closed the connection]
ftajhii has joined #ruby
cappy has quit [Ping timeout: 260 seconds]
<Hammdist> hey all
<Hammdist> in sinatra, how do I do to return an HTML file with a certain substring replaced?
<Hammdist> return IO.binread("./index.html").gsub("{USERNAME}", username); <-- something like this, but with the correct content type
<Hammdist> and somehow specifying :cache => false
<havenwood> Hammdist: You can explicitly `content_type 'text/html'` and `cache_control :no_cache`.
<havenwood> I'd `File.read` since it's hopefully UTF-8 not binary.
<havenwood> If you can make it an ERB template, that'd be preferred to gsubbing the file directly.
_whitelogger has joined #ruby
constxd has quit [Server closed connection]
constxd has joined #ruby
grenierm has joined #ruby
jmcantrell_ has quit [Quit: WeeChat 4.7.0]
jmcantrell_ has joined #ruby
schne1der has joined #ruby
jmcantrell_ has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
The_Camel_ has joined #ruby
chair1 has joined #ruby
flurp has quit [Quit: The Lounge - https://thelounge.chat]
Munto has quit [Ping timeout: 248 seconds]
Munto has joined #ruby
grenierm has quit [Ping timeout: 250 seconds]
<Hammdist> havenwood: nice but if I return a string from sinatra wouldn't that autodetect html (if it is) and automatically apply no-cache since it can only assume it's dynamic?
TomyWork has joined #ruby
jtperreault has quit [Server closed connection]
jtperreault has joined #ruby
ghostbuster has quit [Server closed connection]
ghostbuster has joined #ruby
kenyon has quit [Server closed connection]
kenyon has joined #ruby
Manouchehri has quit [Server closed connection]
Manouchehri has joined #ruby
chair38 has joined #ruby
chair1 has quit [Ping timeout: 250 seconds]
chair38 is now known as chair1
jmjl has quit [Server closed connection]
jmjl has joined #ruby
<o0x1eef> Sinatra doesn't do any of that magic (thank God :))
itaipu has quit [Ping timeout: 258 seconds]
itaipu has joined #ruby
twopoint718 has quit [Server closed connection]
twopoint718 has joined #ruby
schne1der has quit [Quit: schne1der]
user71 has joined #ruby
<havenwood> Hammdist: A `send_file` detects the File mime but Sinatra knowns not where a String came from.
The_Camel_ has quit [Ping timeout: 260 seconds]
nmollerup has quit [Quit: Leaving]
<nakilon> coworkers were making json via erb
<nakilon> it was awful idea
mange has quit [Quit: Zzz...]
Javier has joined #ruby
Javier has quit [Client Quit]
flurp has joined #ruby
<o0x1eef> Usually works alright for YAML so you could be forgiven for that mistake
Jordan has quit [Server closed connection]
Jordan has joined #ruby
Byteflux has quit [Server closed connection]
Byteflux has joined #ruby
flurp has quit [Quit: The Lounge - https://thelounge.chat]
<Hammdist> havenwood: um, so what content type is returned to the client when a handler evalutes to "Hello World"?
cherryramatisdev has joined #ruby
jhass has quit [Remote host closed the connection]
jhass_ has joined #ruby
jhass_ has quit [Remote host closed the connection]
jhass has joined #ruby
cappy has joined #ruby
blacknova has joined #ruby
The_Camel_ has joined #ruby
chair1 has quit [Quit: Client closed]
msv has quit [Remote host closed the connection]
rvalue has quit [Ping timeout: 248 seconds]
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
<o0x1eef> text/plain
<o0x1eef> Let me check though
cappy has quit [Quit: Leaving]
<o0x1eef> text/html appears to be
rvalue has joined #ruby
___nick___ has joined #ruby
cherryramatisdev has quit [Ping timeout: 260 seconds]
cherryramatisdev has joined #ruby
jmcantrell_ has joined #ruby
cherryramatisdev has quit [Ping timeout: 260 seconds]
cherryramatisdev has joined #ruby
jmcantrell_ has quit [Quit: WeeChat 4.7.1]
jmcantrell_ has joined #ruby
jmcantrell_ is now known as jmcantrell
cherryramatisdev has quit [Ping timeout: 260 seconds]
TomyWork has quit [Remote host closed the connection]
CRISPR has joined #ruby
CRISPR has quit [Ping timeout: 260 seconds]
msv has joined #ruby
nmollerup has joined #ruby
user71 has quit [Quit: Leaving]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
cherryramatisdev has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
<kjetilho> nakilon: erb has access to the JSON module, so I don't see the problem?
<kjetilho> (mush everything together in a hash, then dump it in JSON format.)
___nick___ has joined #ruby
cherryramatisdev has quit [Quit: WeeChat 4.7.1]
cherryramatisdev has joined #ruby
cherryramatisdev has quit [Client Quit]
rvalue has quit [Read error: Connection reset by peer]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rvalue has joined #ruby
<o0x1eef> Probably more like: {"foo": "<%= bar %>"} but you can get much more complex than that and I can see how it would become a mess
WhiteNoise has joined #ruby
The_Camel_ has quit [Ping timeout: 260 seconds]
WhiteNoise has quit [Quit: WeeChat 4.7.1]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
ox is now known as oz