havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
graywolf has joined #ruby
reset has quit [Quit: reset]
graywolf has quit [Ping timeout: 240 seconds]
ap4y has quit [Remote host closed the connection]
jhass has quit [Ping timeout: 240 seconds]
jhass has joined #ruby
ap4y has joined #ruby
sam113101 has quit [Quit: WeeChat 3.6]
sam113101 has joined #ruby
sam113101 has quit [Quit: WeeChat 3.6]
sam113101 has joined #ruby
_ht has joined #ruby
grenierm has joined #ruby
playbi24 has joined #ruby
<mooff> = -> { a = "this"; "can also write it like #{a}" }[]
<ruby-eval> => "can also write it like this"
mexen has joined #ruby
sickdyd has quit [Quit: WeeChat 3.8]
_ht has quit [Remote host closed the connection]
ap4y has quit [Remote host closed the connection]
sickdyd has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
roadie has joined #ruby
playbi24 has quit [Ping timeout: 268 seconds]
MalusVulgaris has joined #ruby
sickdyd has quit [Ping timeout: 250 seconds]
sickdyd has joined #ruby
<ox1eef_> And proc { local = 1 }.() too
teclator has joined #ruby
clemens3 has quit [Quit: WeeChat 2.7]
clemens3 has joined #ruby
Rounin has quit [Read error: Connection reset by peer]
MalusVulgaris has quit [Quit: MalusVulgaris]
sickdyd has quit [Read error: Connection reset by peer]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
dionysus69 has joined #ruby
mexen has quit [Quit: Connection closed for inactivity]
sickdyd has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
crespire1 has quit [Ping timeout: 240 seconds]
Furai has quit [Quit: WeeChat 3.8]
crespire has joined #ruby
Furai has joined #ruby
grenierm has quit [Ping timeout: 245 seconds]
sickdyd has joined #ruby
reset has joined #ruby
sickdyd has quit [Ping timeout: 248 seconds]
sickdyd has joined #ruby
quintasan has quit []
quintasan has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
shiru has joined #ruby
hwpplayer1 has joined #ruby
blackmetal has joined #ruby
<blackmetal> havenwood: Pardon but have you ever setup async-websocket/async-redis on Rails? if so could you share your config?
<blackmetal> (setting up a reduced testcase as we speak)
<blackmetal> My websockets worked fine until switching from Puma to Falcon. Most Falcon examples are for Ruby apps in general and not Rails which goes beyond my understanding so
TomyWork has joined #ruby
<blackmetal> Btw the script I'm working on now is INSANE
<blackmetal> Converts audio to MIDI using AI, but since that process it not really reliable, it employs MIDI libs to quantize and turn stuff into proper chords
<blackmetal> It then plays this off using a Ruby synth
<blackmetal> Free unlimited MIDI and entertainment. Plus we can start adding arpeggiators to the new MIDI, change scales etc. and end up with original music
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 256 seconds]
markong has joined #ruby
Sankalp has quit [Ping timeout: 265 seconds]
Sankalp has joined #ruby
sickdyd has joined #ruby
hightower3 has quit [Quit: Leaving]
sickdyd has quit [Ping timeout: 240 seconds]
markong has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
shiru has quit [Quit: leaving]
sickdyd has joined #ruby
<havenwood> blackmetal: No, I haven't used it with Rails. Last I checked, there was still a bit of work that needed merging on Rails to support Fibers rather than Threads for the DB pooling.
<blackmetal> i see
* blackmetal using rails 7.1.alpha with the latest falcons (testrepo coming asap)
sickdyd has quit [Ping timeout: 246 seconds]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 246 seconds]
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
moldorcoder7_ has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
kokoro has quit [Ping timeout: 250 seconds]
sickdyd has quit [Ping timeout: 264 seconds]
graywolf has joined #ruby
_brummie has joined #ruby
graywolf has quit [Client Quit]
cek has joined #ruby
_brummie has left #ruby [#ruby]
<ox1eef_> havenwood: wazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzup *budweisers 1990s style*
kokoro has joined #ruby
dionysus69 has quit [Quit: dionysus69]
sickdyd has joined #ruby
___nick___ has joined #ruby
ultralan has joined #ruby
<adam12> LOL
ultralan has quit [Remote host closed the connection]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
sickdyd has quit [Ping timeout: 268 seconds]
moldorcoder7 has joined #ruby
kokoro has quit [Ping timeout: 240 seconds]
<adam12> My 'The Ruby Programming Language' book arrived today (Flanagan & Matz authors). I don't recall ever reading this one. Be interesting to look back to ~ 2008 when it was published and see what was different.
sickdyd has joined #ruby
kokoro has joined #ruby
<mooff> when was .each introduced?
sickdyd has quit [Ping timeout: 240 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
<adam12> mooff: You know, I thought I'd go look at the genesis git commit (which is an svn import), but I don't see anything. The project structure is a lot different back then. I wonder if it's related to my git checkout.
___nick___ has joined #ruby
<adam12> I think it was the commit. The genesis commit is kind of anemic.
<adam12> This book has drawings from _why. Which is interesting. I wonder how it compares to the Poignant Guide drawings.
<mooff> neat
John_Ivan has joined #ruby
John_Ivan_ has quit [Ping timeout: 268 seconds]
_ht has joined #ruby
desnudopenguino has joined #ruby
lena64t has quit [Remote host closed the connection]
sickdyd has joined #ruby
lena64t has joined #ruby
sickdyd has quit [Ping timeout: 268 seconds]
sickdyd has joined #ruby
TomyWork has quit [Remote host closed the connection]
<ox1eef_> I support the use of for if only because there's too many opinionated Ruby tools and frameworks that squeeze the air out of the room.
<adam12> LOL
roadie has quit [Quit: ERC 5.5 (IRC client for GNU Emacs 29.0.90)]
sickdyd has quit [Ping timeout: 240 seconds]
hwpplayer1 has quit [Quit: cylater]
<aesthetikx> if you want a blast from the past check this out: https://ftp.tw.freebsd.org/distfiles/ruby/
<aesthetikx> some ancient stuff in there
<aesthetikx> e.g. download rice-0.0.0.2.tar.gz, some ruby from '99 in there. Lots of different interpretations of how to use the syntax
<adam12> Nice,
hwpplayer1 has joined #ruby
reset has quit [Ping timeout: 240 seconds]
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
lunks has quit [Quit: WeeChat 3.6]
sickdyd has joined #ruby
cek has quit [Quit: Connection closed for inactivity]
sickdyd has quit [Ping timeout: 240 seconds]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 250 seconds]
desnudopenguino1 is now known as desnudopenguino
sickdyd has joined #ruby
<johnjaye> is the end required for "if" statements?
<weaksauce> yeah
<weaksauce> unless you do it on one line like
<weaksauce> puts "hi" if true
sickdyd has quit [Ping timeout: 256 seconds]
fooo has joined #ruby
hwpplayer1 has quit [Quit: cylater]
fooo has quit [Quit: Client closed]
fooo has joined #ruby
fooo has quit [Client Quit]
_ht has quit [Quit: _ht]
___nick___ has quit [Ping timeout: 240 seconds]
<johnjaye> is this not valid ruby either?
<johnjaye> i thought i could do that instead of File.open(..) do |file|
<adam12> johnjaye: No. It's the method that takes the block.
<johnjaye> oh ok. meaning read
<adam12> johnjaye: Tho maybe you could do f.then do |file|
<adam12> johnjaye: That said, the purpose of the block in this case is to ensure you're closing the file and not leaking the file descriptor.
<johnjaye> oh. so the f.close is not needed?
<adam12> With a manual open/close, the block is providing you no real value.
<johnjaye> ok
<adam12> Well it is in your example. But if you did File.open("somefile") { |file| file.write "bar" } then it wouldn't be necessary. The file is closed at the block end.
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
<mooff> = def foo() "foo method" end; foo = "foo string"; [foo, foo(), foo { raise "this block isn't called" }]
<ruby-eval> => ["foo string", "foo method", "foo method"]
sickdyd has quit [Ping timeout: 264 seconds]
reset has joined #ruby
<leftylink> hmm... I can't see f.then having the desired effect here either
<adam12> leftylink: Closing the file?
<leftylink> right
<leftylink> because I was assuming File.open was written in some way like
<leftylink> pandabot rb def fileopen; if block_given?; "opened file, then did #{yield}, then closed file"; else "just opened file" end; end; f = fileopen; f.then { puts "yup #{_1}" }
<pandabot> yup just opened file - 1 more lines - https://carc.in/#/r/f2yx
<adam12> Right. I don't expect it to work with `then`.
<adam12> Just calling out the block style functionality that would work for them, but highlighting the purpose of the block to File#open
<adam12> Also, interestingly part of the convo yesterday, `then` can be used to make a local "scope" similar to an IIFE.
<adam12> >> self.then { x = 1 }; x
<ruby[bot]> adam12: # => undefined local variable or method `x' for main:Object (NameError) (https://carc.in/#/r/f2yy)
<leftylink> it's really interesting how you have to have the self. there!
<leftylink> because of then being a keyword
<leftylink> but I see we can give functions names that are keywords indeed, with no problems...
<leftylink> pandabot: rb def if; 5 end; self.if
<leftylink> of course we must have self. there, or else it's just a syntax error
<leftylink> so that's really interesting
<adam12> Yeah. Originally I had `Object.then`
<adam12> I thought I could cheat and use `then` but you're right, it is a keyword. I just forgot it was.
<mooff> then is good
<mooff> = self.then { x = 1; x }
<ruby-eval> => 1
<aesthetikx> isn't there a #then alias
<mooff> it was first called yield_self
<mooff> then #then was added as an alias
<aesthetikx> you can `tap { x = 1; x }; x` too :)
<aesthetikx> I think tap is the shortest method on Object that takes a block, but lets verify
<mooff> tap is a such a good method
<aesthetikx> `->{ }[]` works too i guess but that is busy
tomtmym has quit [Quit: Gone.]
<aesthetikx> back on topic though, the weird ruby scoping behavior is actually nice, because you can `if something; first_time_used_variable = 5; end` and then later `if first_time_used_variable`, even though the variable could never have been set if the original conditional was false
<aesthetikx> I dont' think many other languages let you do that, you have to declare those variables as null or nil or undefined outside the first condition
graywolf has joined #ruby
sickdyd has joined #ruby
<leftylink> that reminds me of "a = a"
<leftylink> pandabot: rb a = a; end
<pandabot> stderr: -e:3: syntax error, unexpected `end', expecting end-of-input - exit 1 - https://carc.in/#/r/f2z0
<leftylink> oops, not end
<leftylink> pandabot: rb a = a; a
<pandabot> nil - https://carc.in/#/r/f2z1
<leftylink> pandabot: what's correct, nil! wat
<leftylink> although I must say, it would have been better to run that `a = a` in a different irb!
<leftylink> because it actually was already created earlier!
<leftylink> when `a = b`
<leftylink> even though the assignment failed with NameError!
<leftylink> pandabot: rb begin; a = b; rescue; end; a
<pandabot> nil - https://carc.in/#/r/f2z3
<leftylink> see
<leftylink> pandabot: rb begin; a = b; rescue NameError; "it name errors as you would expect. #{a.inspect}"; end
<pandabot> "it name errors as you would expect. nil" - https://carc.in/#/r/f2z4
<leftylink> hmm, well, ->{}[] was actually the first thing that came to mind, since when I want a scope it is obvious that a function would do it, vs if I'd use a block with tap I have to stop to think about whether it does
<leftylink> but perhaps if I had the rules more fully ingrained it may be the other way around
<leftylink> so as the kids say these days... that's a skill issue on my part
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
ap4y has joined #ruby
<mooff> aesthetikx: yeah, the scope of local variables is neat in Ruby. and not what you first expect
gr33n7007h has quit [Ping timeout: 268 seconds]
<mooff> code in a def, class or module body can't see locals set outside of themselves
gr33n7007h has joined #ruby
<mooff> it's like the parser scans to the end of the block, finds the "foo = " statements, then marks the names of local variables assigned in that scope
sickdyd has quit [Ping timeout: 264 seconds]
sickdyd has joined #ruby
<mooff> it's hard to describe, but the way they're lexical is interesting
<mooff> = binding.local_variable_set(:hello, "world"); hello
<ruby-eval> ERROR: undefined local variable or method `hello' for main:Object
<leftylink> hmm reading that statement in a cetain way makes it sound like the parser does it out-of-order or two passes but I don't think I see evidence for that
<mooff> you can "set" a new local variable on a binding via local_variable_set(), but it's academic as the parser already decided it doesn't exist
<mooff> in bytecode, i bet "foo" doesn't come out as "retrieve local, call method if not in locals"
<leftylink> huh, didn't think that would happen. interesting
<mooff> but either "retrieve local" or "send method" based on whether an assignment existed at parse time
teclator has quit [Ping timeout: 265 seconds]
graywolf has quit [Quit: WeeChat 3.8]
finsternis has joined #ruby
FetidToot has quit [Ping timeout: 240 seconds]
slothby has quit [Quit: brb ... maybe]
slothby has joined #ruby
joast has joined #ruby