havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.0, 3.1.3, 3.0.5, 2.7.7: 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/
tomtmym has quit [Quit: Gone.]
victori has joined #ruby
Pixi` has quit [Quit: Leaving]
crax23 has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
cartdrige has joined #ruby
Pixi has joined #ruby
_ht has quit [Quit: _ht]
markong has quit [Ping timeout: 252 seconds]
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 260 seconds]
sachot has joined #ruby
razetime has joined #ruby
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
willow has quit [Ping timeout: 268 seconds]
Linux_Kerio has joined #ruby
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #ruby
sachot has quit [Quit: Leaving.]
Sheilong has quit []
desnudopenguino has quit [Ping timeout: 255 seconds]
jhass has quit [Ping timeout: 272 seconds]
jhass has joined #ruby
willow has joined #ruby
willow has quit [Changing host]
willow has joined #ruby
willow has quit [Ping timeout: 268 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Linux_Kerio has quit [Ping timeout: 268 seconds]
brw has quit [Remote host closed the connection]
tomtmym has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
aeris has quit [Quit: ZNC - http://znc.sourceforge.net]
_aeris_ has joined #ruby
_aeris_ is now known as aeris
razetime has quit [Remote host closed the connection]
joto has quit [Ping timeout: 248 seconds]
joto has joined #ruby
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
_ht has joined #ruby
hightower3 has quit [Ping timeout: 272 seconds]
hightower2 has joined #ruby
grawity has quit [Remote host closed the connection]
grawity has joined #ruby
Linux_Kerio has joined #ruby
razetime has joined #ruby
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #ruby
ssh0732 has joined #ruby
markong has joined #ruby
ssh0732 has quit [Quit: The Lounge - https://thelounge.chat]
<leftylink> damn. sometimes I really wish we had SortedSet back. and I mean the actually-performant version not the crappy version
<leftylink> I know I know youre just going to tell me "just use a gem"
<leftylink> well shit man sometimes the gem isn't available
<leftylink> so what do you want me to do
ssh0732 has joined #ruby
brw has joined #ruby
<leah2> just use a hash :p
goldfish has joined #ruby
FullMetalStacker has joined #ruby
goldfish has quit [Quit: Leaving]
goldfish has joined #ruby
<leftylink> matz rejected it, "Unlike the past, it's not smart to add the standard library. Use gem." https://bugs.ruby-lang.org/issues/2348. so it looks like it will never happen. unless new information comes to light that makes it worth reconsidering
<leftylink> huge shame. they think tsort is worth putting in standard library, but not sorted set
__ht has joined #ruby
_ht has quit [Ping timeout: 272 seconds]
__ht is now known as _ht
FullMetalStacker has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
razetime has quit [Ping timeout: 252 seconds]
<leftylink> it's too easy to engage in whataboutism here like "what about <other language>? they have sorted sets"
<leftylink> but whataboutism is not conducive to finding the best arguments for Ruby
<leftylink> so a truly persuasive argument should argue from first principles and real-world applications
<leftylink> well, how were other standard gems added?
<leftylink> what was the process
<leftylink> eh...
<leftylink> just "approved", no discussion
<leftylink> well the other alternative when gems aren't available is of course "you write your own sorted set implementation"
walez has joined #ruby
<leftylink> if someone responds "but I don't want to implement my own because I like to stand on the shoulders of giants" then someone else will respond "so you don't want to implement your own because you are lazy and don't contribute to society"
<leftylink> though there are practical considerations - it is not necessarily easy to make it fast. may want to use a C extension
<leftylink> and then they say "I want it to be fast because I want to have a priority queue and performance is critical" and then people respond "joke's on you for using Ruby in a context when performance is critical" and they get laughed out of the room. I've seen this conversation dozens of times before and I'm tired of it
Linux_Kerio has quit [Ping timeout: 264 seconds]
__ht has joined #ruby
_ht has quit [Ping timeout: 260 seconds]
__ht is now known as _ht
razetime has joined #ruby
walez has quit [Quit: Leaving]
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
cartdrige has joined #ruby
dionysus69 has joined #ruby
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
goldfish has quit [Quit: Leaving]
cartdrige has joined #ruby
<gr33n7007h> i bet there's a few sore heads in here today xD
ssh0732 has quit [Remote host closed the connection]
FetidToot has joined #ruby
<adam12> Heh
ssh0732 has joined #ruby
razetime has quit [Remote host closed the connection]
FullMetalStacker has joined #ruby
FullMetalStacker has quit [Client Quit]
<weaksauc_> my wrist is sore is all
desnudopenguino has joined #ruby
ukazap has joined #ruby
ukazap_ has joined #ruby
ukazap_ has quit [Client Quit]
gAy_Dragon is now known as A_Dragon
ukazap has quit [Read error: Connection reset by peer]
crax23 has joined #ruby
Y05hito__ has joined #ruby
cartdrige has quit [Ping timeout: 260 seconds]
crax23 has quit [Ping timeout: 248 seconds]
Linux_Kerio has joined #ruby
markong has quit [Ping timeout: 246 seconds]
Sheilong has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
willow has joined #ruby
FullMetalStacker has joined #ruby
FullMetalStacker has quit [Client Quit]
Mikaela has quit [Remote host closed the connection]
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
Mikaela has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
otisolsen70 has quit [Quit: Leaving]
dionysus69 has joined #ruby
sympt has quit [Ping timeout: 268 seconds]
henk has joined #ruby
crax23 has joined #ruby
Y05hito__ has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
_ht has quit [Quit: _ht]
wra1th has joined #ruby
<henk> is there a convenient way to match an IP address with a regex? or do I just have to write it out like [[:digit:]]{1,3}\.etc?
<Rounin> Even then, it would technically have to account for the number ranges... Then there's IPv6
wra1th has quit [Client Quit]
<Rounin> I mean, the 200s only go up to 255... But then, 249 is allowed, but not 259
<henk> Rounin: yeah, exactly why I’m asking (: what I wrote is ugly and not even correct but the correct version is even more ugly
<Rounin> Yeah... It's not a typical regex problem
<henk> oh, damn, XY problem, let me rephrase
<weaksauc_> what are you trying to fdo
<Rounin> It might be easier to just see if it can be parsed as an int, fit into an 8-bit unsigned number and perhaps check that it doesn't have leading zeroes (unless that's allowed)
<henk> I have a string containing an IP address among other stuff. I want to extract the IP address from that string.
<Rounin> Oh... So it might not have to be correct
<henk> don’t care whether with a regex or not. it’s most likely IPv4
<weaksauc_> is the string formatted regularly?
<Rounin> [0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9]\.[0-2]?[0-9]?[0-9] perhaps
<henk> and I’m not verifying some untrusted input but working with the output of some program. which may or may not actually return output containing an IP and it’s ok if my ruby program just fails and exits if it cannot find an IP in the output.
<Rounin> It would also allow invalid ones like 0.299.275.1, but still
<henk> weaksauc_: if everything goes well, yes
<henk> but if not, then something else will fail already, so let’s just assume that it is (:
<weaksauc_> nothing easily separated like a field seperator?
<henk> I know I can just match on /IP \[0\]: '(.*)'/ because the IP is in between the '' but I’m wondering if there is a more reliable way that actually tries to get the IP. because I’m also not sure whether that other program might just output »IP [0]: ''« in case of problems …
<henk> in this case, it doesn’t matter much, but generally I like safety. so if it doesn’t mean much hassle, I’d like to go the safer route …
<weaksauc_> which program?
<henk> weaksauc_: mbimcli
<weaksauc_> ah
<weaksauc_> (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
<weaksauc_> ugly
<weaksauc_> i wonder if there is anything in stdlib to parse ips
<henk> yeah, that’s exactly my point: it’s very ugly. if I were to use this, I’d put it in an object that stands alone, ideally in shame, in some corner of my code. I certainly don’t want to put this monster right in the middle of some line :D
<henk> IPAddr.new does not accept a string containing any other stuff but an IP address, it seems … that’s the only thing I found so far that sounded at least a little promising
<weaksauc_> yeah could use that
<weaksauc_> use a simple regex and catch errors
sympt has joined #ruby
willow has quit [Quit: willow]
desnudopenguino has quit [Ping timeout: 260 seconds]
<henk> ipv4_byte = /[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]/
<henk> cidr_mask = /[0-9]|[1-2][0-9]|30|31|32/
<henk> ipv4 = /#{ipv4_byte}.#{ipv4_byte}.#{ipv4_byte}.#{ipv4_byte}(\/#{cidr_mask})?/
<henk> this seems not soooo bad
<henk> Rounin, weaksauc_: thanks for your inputs!
<weaksauc_> np
perrierjouet has quit [Quit: WeeChat 3.7.1]
aeris has quit [Remote host closed the connection]
perrierjouet has joined #ruby
aeris has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
<Rounin> No worries!
sympt has quit [Quit: Ping timeout (120 seconds)]
sympt has joined #ruby
tomtmym has quit [Quit: Gone.]
plantman has joined #ruby
whysthatso125070 has joined #ruby
willow has joined #ruby
willow has quit [Changing host]
willow has joined #ruby
<leftylink> hold on
<leftylink> doesn't this exist
<leftylink> pandabot rb require 'resolv'; Resolv::IPv4::Regex
<pandabot> /\A((?x-mi:0 - 12 more lines - https://carc.in/#/r/ebfe
<leftylink> I'll go and assume they know what they're doing when they wrote that
<weaksauc_> good call
markong has joined #ruby
Linux_Kerio has quit [Ping timeout: 246 seconds]
<henk> leftylink: oooh, nice, thank you
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 252 seconds]
crax23 has joined #ruby
Y05hito__ has quit [Ping timeout: 260 seconds]
plantman has quit [Ping timeout: 260 seconds]