jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
Al2O3 has joined #ruby
robotmay has quit [Quit: No Ping reply in 180 seconds.]
robotmay has joined #ruby
jpn has joined #ruby
white_magic has joined #ruby
weaksauc_ has joined #ruby
weaksauce has quit [Ping timeout: 244 seconds]
<sam113101> how would you ever use a beginless range like ..10? I use endless ranges all the time but not beginless ones
<sam113101> in fact I used to always do i..Float::INFINITY, didn't even know you could just leave it off
<adam12> sam113101: I can't ever having a need... but maybe I just used it and never recorded it in memory.
<eam> Range doc gives what I think is the only possible use case: array slices
<sam113101> is there an in keyword in ruby, other than in for expressions?
<sam113101> [35] pry(main)> 7 in ..10
<sam113101> => true
<sam113101> what's that
<eam> pattern matching
<sam113101> is it new in ruby?
<sam113101> I know what pattern matching is but didn't know ruby had it
<adam12> It's a 2.7+ feature (I think in 2.7 it's marked experimental)
<sam113101> what about keyword arguments, when were they introduced?
<adam12> sam113101: 2.0 received the first iteration, and then 3.0 made them _proper_ kw args, where they were separate.
<adam12> It was a known limitation at 2.0 time but they didn't know how to work around it.
<adam12> It's likely the biggest 2.x -> 3.x change that caused any grief.
m_antis has quit [Ping timeout: 265 seconds]
robotmay has quit [Ping timeout: 260 seconds]
adam12 has quit [Quit: The Lounge - https://thelounge.chat]
robotmay has joined #ruby
adam12 has joined #ruby
m_antis has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
<sam113101> wasn't there a way to address arguments of a block by number? like { $0 > $1 } instead of { |a, b| a > b }, but obviously it's not that
jpn has joined #ruby
nirvdrum has joined #ruby
ixti has joined #ruby
<adam12> sam113101: _1, _2, etc.
jpn has quit [Ping timeout: 250 seconds]
<sam113101> adam12: oh, I had tried that but I thought it would start with _0…
Al2O3 has quit [Ping timeout: 250 seconds]
white_magic has quit [Quit: Client closed]
eddof13 has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
nirvdrum has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leftylink> I could see beginless ranges being used in a `case` as well. Comparable#clamp could be a possibility too, though there are enough alternatives to that I suppose we can't use that to argue for it
eddof13 has joined #ruby
jdmark has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jdmark has joined #ruby
jpn has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
teclator has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
jdmark has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdmark has joined #ruby
eddof13 has joined #ruby
<littlebuddy> Hi! Anybody here happen to be up for hire for a couple of hours to help fix some bugs in Rails?
eddof13 has quit [Client Quit]
jpn has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
<AstrallyForged> I'm embedding a little Ruby in the larger project. It spawns a Ruby interpreter with a small script and uses stdio for communicating with it. I'm using YAML as a common format.
<AstrallyForged> It's mostly working, except that it seems to wait for stdin to be closed before doing anything—I need it to process YAML documents one at a time as soon as a complete document is received.
<AstrallyForged> It's based around `YAML.load_stream $stdin do`.
<AstrallyForged> Minimal reproduction is to just run `ruby -r yaml -e 'YAML.load_stream($stdin) { |x| pp x }'` in a terminal and type in a few short documents.
Goodbye_Vincent has joined #ruby
gr33n7007h has quit [Ping timeout: 264 seconds]
gr33n7007h has joined #ruby
<leftylink> well the difficulty I woul dhave with this is, how can it be possible to know when a document ends? for example, with the document "a: b" how do I know I've seen all the key value pairs? there could be another line "c: d" right after, so I can't know
<AstrallyForged> That's what `...` is for, isn't it?
ur5us has joined #ruby
<leftylink> I must look very foolish. what I said doesn't make sense anyway because even if ... didn't exist, --- would start a new document anyway and the stream reader could know to start a new document right then and there
<leftylink> and deal with the prevoius document which was already known to be complete
<leftylink> in that case all I can say is "what a shame that YAML.load_stream evidently does not do that"
<AstrallyForged> …it looks like it does what I want if I use EOF instead of `...`.
<AstrallyForged> But I don't think I can generate EOF when stdin is a pipe to another process…
<AstrallyForged> Without, y'know, closing it
<AstrallyForged> …okay, so I guess the solution here is to read more manually from stdin, looking for the marker, and then pass a string to `YAML.load`
Sankalp has quit [Ping timeout: 252 seconds]
<AstrallyForged> `$stdin.readline "...\n"` ^.^
<AstrallyForged> (technically this isn't correct YAML; any whitespace can follow the marker…but I'm judging it fine; this is pretty tightly coupled and doesn't need to interoperate)
<gr33n7007h> AstrallyForged: can you gist your code?
ur5us has quit [Ping timeout: 264 seconds]
Sankalp has joined #ruby
<AstrallyForged> gr33n7007h: I got it working, thanks!
<AstrallyForged> If you're curious: https://paste.rs/bpE.rb
<AstrallyForged> modulo `require`
<gr33n7007h> AstrallyForged: can you paste it to a different paste-bin site, this one isn't working for me, thanks.
<AstrallyForged> gr33n7007h: https://0x0.st/oW7-.rb ?
<gr33n7007h> AstrallyForged: yes, that works for me =)
ur5us has joined #ruby
<AstrallyForged> wait, apparently the file extensions are significant on 0x0.st. O.o
<AstrallyForged> https://0x0.st/oW7-.txt *
<gr33n7007h> AstrallyForged: can't you just send ^D
<AstrallyForged> gr33n7007h: Only way to do that is to close the pipe, no?
<gr33n7007h> AstrallyForged: ah, sorry, i missed that bit.
kristianpaul has quit [Read error: Connection reset by peer]
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
kristianpaul has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
dionysus69 has joined #ruby
lagash has quit [Ping timeout: 260 seconds]
lagash has joined #ruby
jpn has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
dionysus69 has joined #ruby
<sam113101> I multithreaded my program but it still only maxes out one core? GIL?
infinityfye has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
TomyWork has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
skuntee4 has joined #ruby
skuntee4 has quit [Client Quit]
Mikaela has quit [Remote host closed the connection]
Mikaela has joined #ruby
jpn has joined #ruby
ur5us has quit [Ping timeout: 248 seconds]
sagax has quit [Ping timeout: 246 seconds]
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
quibblers6 has joined #ruby
quibblers6 has quit [Ping timeout: 265 seconds]
quibblers6 has joined #ruby
quibblers6 has quit [Ping timeout: 260 seconds]
quibblers6 has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
quibblers6 has quit [Ping timeout: 252 seconds]
moldorcoder7 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
nirvdrum has joined #ruby
littlebuddy has quit [Ping timeout: 265 seconds]
fef has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
dionysus69 has joined #ruby
markong has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
ua_ has joined #ruby
ua__ has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
jpn has joined #ruby
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
mikecmpbll has quit [Ping timeout: 244 seconds]
Al2O3 has joined #ruby
mikecmpbll has joined #ruby
eddof13 has joined #ruby
zitter has joined #ruby
zitter has left #ruby [Leaving]
Mikaela has quit [Ping timeout: 258 seconds]
Mikaela has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Al2O3 has quit [Ping timeout: 250 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
dionysus69 has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
jpn has joined #ruby
royo25 has joined #ruby
eddof13 has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
fef has quit [Remote host closed the connection]
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
jpn has joined #ruby
_ixti_ has joined #ruby
ixti has quit [Ping timeout: 250 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
aeris has quit [Remote host closed the connection]
jpn_ has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
aeris has joined #ruby
jetchisel has quit [Ping timeout: 268 seconds]
Mikaela has quit [Remote host closed the connection]
Mikaela has joined #ruby
jetchisel has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
jetchisel has quit [Ping timeout: 244 seconds]
jpn_ has quit [Ping timeout: 265 seconds]
jpn has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sgt_chuckles has joined #ruby
royo25 has quit [Quit: Bye]
<jhass[m]> Probably, unless using Ractor's or C extensions MRI isn't good for CPU intensive workloads
jpn has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
jetchisel has joined #ruby
sgt_chuckles has quit [Quit: Client closed]
_ixti_ has quit [Read error: Connection reset by peer]
ixti has joined #ruby
ixti has quit [Client Quit]
Mikaela has quit [Remote host closed the connection]
Mikaela has joined #ruby
eddof13 has joined #ruby
georgemp has quit [Quit: ZNC - https://znc.in]
georgemp has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fef has joined #ruby
markong has quit [Ping timeout: 268 seconds]
ua_ has quit [Ping timeout: 252 seconds]
jetchisel has quit [Ping timeout: 250 seconds]
eddof13 has joined #ruby
fef has quit [Remote host closed the connection]
fef has joined #ruby
nirvdrum has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
whysthatso125070 has joined #ruby
nirvdrum has joined #ruby
ur5us has joined #ruby
TomyWork has quit [Remote host closed the connection]
pgib has joined #ruby
Mikaela has quit [Remote host closed the connection]
ahayworth has quit [Ping timeout: 268 seconds]
ahayworth has joined #ruby
cocalero_ has joined #ruby
Aminda has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
Al2O3 has joined #ruby
cocalero_ has quit [Quit: Going offline, see ya! (www.adiirc.com)]
libsys has joined #ruby
jpn has joined #ruby
<libsys> hello people... I'm working on some minetest based tests, and I need to test a simplified mailer that takes 3 params: `SMTP.sendmail(to, subject, body)` ... internally it uses Net::SMTP, so I need to stub .start and .send_message in order to be able to excecute the test while not actually sending any mail
<libsys> but IDK how to express that
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
mikecmpbll has quit [Ping timeout: 252 seconds]
mikecmpbll has joined #ruby
<libsys> since start opens a block I thought on something like `Net::SMTP.stub(:start, ->(helo, user, secret, authtype) { yield } do |smtp| smtp.stub(:send_message, true) do MySMTP.sendmail('to', 'subject', 'body') end end end`
jpn has quit [Ping timeout: 265 seconds]
<libsys> but that yield doesn't work and tbh I'm not even sure or what I'm doing
<libsys> I just know I need to stub Net::SMTP
<libsys> .start and .send_message
mikecmpbll has quit [Ping timeout: 252 seconds]
arahael has quit [Ping timeout: 264 seconds]
libsys has quit [Quit: WeeChat 3.0]
libsys has joined #ruby
skuntee4 has joined #ruby
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
nirvdrum has quit [Quit: nirvdrum]
arahael has joined #ruby
jpn has joined #ruby
<leftylink> well, your implementation of start must present the same interface as Net::SMTP.start, otherwise the test will lie about what is and isn't correct. well, the interface of start is that it calls the block, passing the smtp object as block argument. okay, so that means in the worst case, even if minitest supports nothing else, you could say `smtp = Object.new; def smtp.send_message(...) :message_send end`
<leftylink> and then the implementation of start would just be `yield(smtp)`. of course this has the usual caveats of it doesn't check that the test implementation of send_message has the same args as the original
jpn has quit [Ping timeout: 268 seconds]
reset has quit [Quit: reset]
skuntee4 has quit [Ping timeout: 252 seconds]
Al2O3 has quit [Remote host closed the connection]
Al2O3 has joined #ruby
infinityfye has quit [Quit: Leaving]
whysthatso125070 has joined #ruby
jpn has joined #ruby
markong has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
fef has quit [Ping timeout: 258 seconds]
Al2O3 has quit [Ping timeout: 264 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jpn has quit [Ping timeout: 265 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 265 seconds]
Al2O3 has joined #ruby
eddof13 has joined #ruby
jpn has joined #ruby
moldorcoder7 has quit [Ping timeout: 248 seconds]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
whysthatso125070 has joined #ruby
Rounin has quit [Ping timeout: 250 seconds]
jpn has quit [Ping timeout: 265 seconds]
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
whysthatso125070 has joined #ruby
mikecmpbll has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 260 seconds]
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
whysthatso125070 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Al2O3 has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 248 seconds]
jpn has joined #ruby
wra1th has joined #ruby
jpn has quit [Ping timeout: 252 seconds]