havenwood changed the topic of #ruby to: Ruby 3.4.3, 3.3.8 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
MsInput has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
troojg has joined #ruby
STASIdownunder has quit [Remote host closed the connection]
MsInput has quit [Quit: WeeChat 4.6.0]
fercell has quit [Quit: ZNC - https://znc.in]
fercell has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
troojg has quit [Remote host closed the connection]
Linux_Kerio has joined #ruby
cappy has quit [Quit: Leaving]
donofrio has quit [Remote host closed the connection]
grenierm has joined #ruby
jmcantrell has quit [Ping timeout: 252 seconds]
jmcantrell_ is now known as jmcantrell
__jmcantrell__ has joined #ruby
__jmcantrell__ has quit [Quit: WeeChat 4.6.1]
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 248 seconds]
rvalue- is now known as rvalue
STASIdownunder has joined #ruby
andy-turner has joined #ruby
fantazo has joined #ruby
andy-turner has quit [Remote host closed the connection]
STASIdownunder has quit [Ping timeout: 276 seconds]
<nakilon> nice, works as planned
<nakilon> exact place where the infinite loop starts https://i.imgur.com/038iQ9G.png
R2 has joined #ruby
R2robot has quit [Ping timeout: 276 seconds]
<nakilon> I mean... not the exact... it's the thing that I call infinitely, but I need to get the caller info somehow
<nakilon> hm (
<nakilon> but if I bind to :line it will generate too much data
<nakilon> :line does not add a clue
R2 has quit [Ping timeout: 248 seconds]
R2robot has joined #ruby
<nakilon> solved, "#{cut.call caller_locations[1].path}:#{caller_locations[1].lineno} > #{tp.callee_id}"
<nakilon> (don't mind cut.call -- it's doing the .delete_prefix)
schne1der has joined #ruby
<o0x1eef> Coola boola!
jmjl has quit [Remote host closed the connection]
jmjl has joined #ruby
dviola has joined #ruby
STASIdownunder has joined #ruby
<o0x1eef> I agree with havenwood though, for benchmark-type stuff Process.clock_gettime is usually the better option than Time.now
STASIdownunder has quit [Read error: Connection reset by peer]
OverCoder is now known as inhehe
grenierm has quit [Ping timeout: 240 seconds]
lpapp has joined #ruby
<lpapp> hi, how to sort a set in ruby?
<lpapp> set.to_a.sort?
<wbooze> require 'set'
<wbooze> s = Set.new([11, 12, 3, 2, 4, 5, 89, 1])
<wbooze> sorted_s = SortedSet.new(s)
<wbooze> puts sorted_s.to_a # Output: [1, 2, 3, 4, 5, 11, 12, 89]
<wbooze> or convert it to an array
<wbooze> sorted_array = s.to_a.sort
<wbooze> puts sorted_array # Output: [1, 2, 3, 4, 5, 11, 12, 89]
<lpapp> thanks, is there a recommended online ruby interpreter?
<lpapp> to test code.
<lpapp> and then run it with required 'set', etc.
<lpapp> my colleague authored some code like foo = Set.new.sort
<lpapp> I wonder what foo would be in this case.
<lpapp> Set.new.sort looks weird
<lpapp> after migrating to Ruby, he changed from foo = SortedSet.new to foo = Sort.new.sort
<lpapp> but that does not look like a valid conversion to me.
<lpapp> But I am new to ruby
<lpapp> I am trying to debug a problem in a code that I inherited.
<lpapp> thanks
<o0x1eef> There's also https://carc.in/#/rb that the channel bot uses
<wbooze> In Ruby, a Set does not maintain order, but you can sort it using SortedSet from the set library
<o0x1eef> >> 2 + 2
<ruby[bot]> o0x1eef: # => 4 (https://carc.in/#/r/hvpt)
<wbooze> aah ok, so we have a builtin ruby interpreter
<lpapp> I thought SortedSet was removed in Ruby 3?
<o0x1eef> Yep for simple stuff
<wbooze> oh hmmm, removed ?
<wbooze> oh my
<lpapp> Yeah, so I am wondering why my colleague moved foo = SortedSet.new to foo Set.new.sort
<lpapp> foo = Set.new.sort
<wbooze> not in stdlib anymore ok
<wbooze> but in sorted_set gem
<lpapp> yeah, but how would I sort this out with the stdlib
<lpapp> without an extra gem
<lpapp> s = Set.new | s << ... | and then s.to_a.sort?
<wbooze> that's maybe what your colleague showed you or tried to
<wbooze> why*
<o0x1eef> In case you didn't know the standard library is distributed as gems and that also includes the 'set' gem: https://stdgems.org
<wbooze> heh, that's so confusing
<lpapp> can I also use .map on an array or just set?
<lpapp> foo.map { | f | ... }
<wbooze> default/bundled/library and the stdgems is just a combination all of those
<lpapp> was just wondering if I could do foo.to_a.sort.map
<o0x1eef> I think the plus is that we can update bundled gems without waiting for a Ruby release, so their development can continue independent of language releases and development. It also puts the stdlib on an equal footing with the rest of the ecosystem, although, I always default to the stdlib.
<o0x1eef> >> [1,2,3].map { _1 * 2 }
<ruby[bot]> o0x1eef: # => [2, 4, 6] (https://carc.in/#/r/hvpu)
<lpapp> I tested it out on this: https://onlinegdb.com/7_2KLhmydW
<lpapp> apparently, Sort.new.sort creates an array.
STASIdownunder has joined #ruby
otisolsen70 has joined #ruby
gemmaro_ has quit [Ping timeout: 268 seconds]
GreenResponse has joined #ruby
020AA65J9 has joined #ruby
<o0x1eef> Cool
STASIdownunder has quit [Read error: Connection reset by peer]
STASIdownunder has joined #ruby
erdem has joined #ruby
<leah2> how do i display the unpack help in ri?
mange has quit [Quit: Zzz...]
trillion_exabyte has quit [Ping timeout: 252 seconds]
user71 has joined #ruby
trillion_exabyte has joined #ruby
erdem has quit [Quit: ZNC - https://znc.in]
donofrio has joined #ruby
<adam12> leah2: You're looking for the expressions?
<adam12> It auto expands for me.
<adam12> But funny enough, I can't see how you can get it any other way. I think you used to be able to cheat with `ri rdoc:packed_data`
<leah2> that used to work but not in ruby 3.3.7
<adam12> Does yours not auto-expand?
<leah2> no
<leah2> never did afaiu
<adam12> It's new.
<adam12> ri 6.13.1 is what I am running.
<leah2> ri 6.6.3.1
<leah2> idk, it's included in 3.3.7 i guess
<adam12> ri ruby:packed_data
<adam12> I forgot it's `rubya and not `rdoc`.
<leah2> that works
<leah2> couldnt find that in my shell history, weird
<leah2> meanwhile i read perldoc :D
<adam12> perldoc feels way better
<adam12> At least I can ask it about global variables.
donofrio has quit [Ping timeout: 248 seconds]
__jmcantrell__ has joined #ruby
jmcantrell has quit [Killed (erbium.libera.chat (Nickname regained by services))]
__jmcantrell__ is now known as jmcantrell
jmcantrell_ has joined #ruby
donofrio has joined #ruby
lpapp has left #ruby [#ruby]
donofrio has quit [Ping timeout: 260 seconds]
blacknova has joined #ruby
donofrio has joined #ruby
reset has joined #ruby
donofrio has quit [Ping timeout: 272 seconds]
fantazo has quit [Quit: Lost terminal]
otisolsen70 has quit [Quit: Leaving]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
mweckbecker has quit [Quit: leaving]
mweckbecker has joined #ruby
ih8u has quit [Ping timeout: 265 seconds]
ih8u has joined #ruby
blacknova has quit [Quit: Connection closed for inactivity]
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
Linux_Kerio has quit [Ping timeout: 248 seconds]
schne1der has quit [Ping timeout: 252 seconds]
___nick___ has joined #ruby
nirvdrum741 has joined #ruby
user71 has quit [Quit: Leaving]
___nick___ has quit [Ping timeout: 252 seconds]
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
cappy has joined #ruby
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
GreenResponse has quit [Quit: Leaving]
<o0x1eef> Nice adam12 !
schne1der has joined #ruby
<adam12> o0x1eef: Thanks!
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
hwpplayer1 has joined #ruby
STASIdownunder has quit [Read error: Connection reset by peer]
STASIdownunder has joined #ruby
cappy has quit [Quit: Leaving]
hwpplayer1 has quit [Remote host closed the connection]
schne1der has quit [Ping timeout: 245 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
ollysmith_ has quit [Ping timeout: 276 seconds]
ollysmith has joined #ruby
ollysmith has quit [Quit: ZNC 1.9.1+deb2+b2 - https://znc.in]
ollysmith has joined #ruby
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
msv has quit [Remote host closed the connection]
eddof13 has joined #ruby