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/
gonix has quit [Ping timeout: 265 seconds]
gr33n7007h has quit [Quit: WeeChat 3.7.1]
gr33n7007h has joined #ruby
markong has quit [Ping timeout: 268 seconds]
plantman has joined #ruby
willow has joined #ruby
willow has joined #ruby
<adam12> >> require 'resolv'; "match this IP: 10.0.0.1"[/match this IP: #{Resolv::IPv4::Regex}/]
<ruby[bot]> adam12: # => nil (https://carc.in/#/r/ebng)
<adam12> henk: you can use ruby[bot]
reset has joined #ruby
caedmon has quit [Ping timeout: 265 seconds]
FullMetalStacker has joined #ruby
FullMetalStacker has quit [Client Quit]
willow has quit [Quit: willow]
caedmon has joined #ruby
caedmon has quit [Remote host closed the connection]
Mikaela has quit [Remote host closed the connection]
Mikaela has joined #ruby
plantman has quit [Ping timeout: 255 seconds]
willow has joined #ruby
willow has quit [Changing host]
willow has joined #ruby
razetime has joined #ruby
Y05hito__ has quit [Ping timeout: 256 seconds]
caedmon has joined #ruby
ukazap has joined #ruby
ukazap has quit [Client Quit]
ukazap has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
ukazap has quit [Ping timeout: 268 seconds]
rvalue has joined #ruby
agent_white has joined #ruby
plantman has joined #ruby
agent_white has quit [Quit: brb]
caedmon has joined #ruby
dviola has quit [Quit: WeeChat 3.7.1]
caedmon has quit [Ping timeout: 272 seconds]
agent_white has joined #ruby
Sheilong has quit []
c10l has quit [Quit: See ya! o/]
c10l has joined #ruby
cartdrige has joined #ruby
aeris has quit [Quit: ZNC - http://znc.sourceforge.net]
aeris has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 268 seconds]
joenoon has quit [Quit: Connection closed for inactivity]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 255 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
razetime has quit [Quit: razetime]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 260 seconds]
otisolsen70 has joined #ruby
otisolsen70 has quit [Remote host closed the connection]
otisolsen70 has joined #ruby
teclator has joined #ruby
ur5us has joined #ruby
tomtmym has joined #ruby
plantman has quit [Ping timeout: 260 seconds]
dviola has joined #ruby
Sankalp has quit [Ping timeout: 272 seconds]
Sankalp- has joined #ruby
Sankalp- is now known as Sankalp
dionysus69 has joined #ruby
desnudopenguino has quit [Ping timeout: 260 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
plantman has joined #ruby
___nick___ has joined #ruby
ur5us has quit [Ping timeout: 252 seconds]
plantman has quit [Ping timeout: 255 seconds]
cxl has quit [Quit: bye]
cxl has joined #ruby
Linux_Kerio has joined #ruby
plantman has joined #ruby
_ht has joined #ruby
plantman has quit [Ping timeout: 260 seconds]
FullMetalStacker has joined #ruby
lucartc has joined #ruby
lucartc has left #ruby [#ruby]
FullMetalStacker has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
c10l has quit [Ping timeout: 260 seconds]
<henk> weaksauc_: ack, thanks
<henk> leftylink: yeah, I guess … and yeah, so would I.
<henk> adam12: cool, thanks
<henk> >> p RUBY_VERSION
<ruby[bot]> henk: # => (https://carc.in/#/r/ebq3)
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
<gr33n7007h> >> RUBY_VERSION
<ruby[bot]> gr33n7007h: # => "3.0.1" (https://carc.in/#/r/ebq4)
<henk> gr33n7007h: oooh, ok, thanks (:
<gr33n7007h> henk: 👍
ht_ has joined #ruby
_ht has quit [Ping timeout: 272 seconds]
ht_ is now known as _ht
<henk> leftylink: I created a feature request: https://bugs.ruby-lang.org/issues/19303
ht_ has joined #ruby
crax23 has quit [Ping timeout: 252 seconds]
_ht has quit [Ping timeout: 264 seconds]
ht_ is now known as _ht
<gr33n7007h> henk: you can do that in ruby
markong has joined #ruby
<gr33n7007h> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('\\\Az')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> gr33n7007h: # => "192.168.0.1" (https://carc.in/#/r/ebqr)
<gr33n7007h> ^henk
cartdrige has joined #ruby
<henk> gr33n7007h: cool, thank you. it would nevertheless be nice if the resolv class provided that so I don’t have to do it myself IMHO
<gr33n7007h> henk: sure 👍
<gr33n7007h> not sure they are going to change it though, that change the api of resolv.
<gr33n7007h> it's achored for a reason 😃
c10l has joined #ruby
<henk> gr33n7007h: oh, I don’t expect them to _change_ anything, only _add_ this variant, eg as Resolv::IPv4::Regex_unanchored or so
shiru has joined #ruby
<gr33n7007h> henk: ah, you do say variant in your feature request, i missed that. even so, it unlikely to happen.
<gr33n7007h> being that it's simple enough to do in ruby itself.
<gr33n7007h> maybe it could be warrented, who knows.
<gr33n7007h> i'd just refine resolv myself to make it do what you want.
<ox1eef_> It would be cool if regexps were easier to modify programitcally.
<gr33n7007h> ox1eef_: 💯 agree
razetime has joined #ruby
<gr33n7007h> TIL you can't refine constants and class vairables.
<gr33n7007h> you learn something new everyday 😃
<gr33n7007h> this emoji.lua script for weechat is great.
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
hightower3 has quit [Remote host closed the connection]
hightower3 has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
<ox1eef_> xD
caedmon has joined #ruby
Sheilong has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.7.1]
gr33n7007h has joined #ruby
c10l has quit [Quit: See ya! o/]
c10l has joined #ruby
teclator has joined #ruby
agent_white has quit [Quit: brb]
agent_white has joined #ruby
agent_white is now known as mitt3ns
shiru has quit [Quit: leaving]
desnudopenguino has joined #ruby
teclator has quit [Remote host closed the connection]
c10l has quit [Quit: See ya! o/]
caedmon has quit [Quit: caedmon]
__ht has joined #ruby
hightower3 has quit [Ping timeout: 272 seconds]
_ht has quit [Ping timeout: 246 seconds]
__ht is now known as _ht
c10l has joined #ruby
c10l has quit [Quit: See ya! o/]
dionysus69 has quit [Ping timeout: 268 seconds]
c10l has joined #ruby
razetime has quit [Quit: razetime]
hightower2 has joined #ruby
crax23 has joined #ruby
crax23 has quit [Remote host closed the connection]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 268 seconds]
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 256 seconds]
caedmon has joined #ruby
hightower2 has quit [Ping timeout: 260 seconds]
hightower2 has joined #ruby
Y05hito__ has quit [Ping timeout: 260 seconds]
gr33n7007h has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
joto has quit [Ping timeout: 272 seconds]
joto has joined #ruby
plantman has joined #ruby
xyhuvud has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
dionysus69 has joined #ruby
Linux_Kerio has quit [Ping timeout: 264 seconds]
caedmon has quit [Ping timeout: 264 seconds]
plantman has quit [Ping timeout: 252 seconds]
markong has quit [Ping timeout: 272 seconds]
xyhuvud has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
mitt3ns has quit [Quit: bbl]
c10l has quit [Quit: See ya! o/]
c10l has joined #ruby
ur5us has joined #ruby
desnudopenguino has quit [Ping timeout: 260 seconds]
perrierjouet has quit [Quit: WeeChat 3.7.1]
perrierjouet has joined #ruby
___nick___ has quit [Ping timeout: 256 seconds]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
<henk> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('\\\Az')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> henk: # => "192.168.0.1" (https://carc.in/#/r/ebt4)
<henk> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('\\\A\z')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> henk: # => "192.168.0.1" (https://carc.in/#/r/ebt5)
_ht has quit [Quit: _ht]
<henk> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('\A\z')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> henk: # => too short escape sequence: /\((?x-mi:0 ...check link for more (https://carc.in/#/r/ebt6)
<henk> I don’t get it … whb are the first two the same?? why is A escaped and z is not?
<henk> the last not working I understand: if only A and z are removed, there are leftover backslashes …
rvalue has quit [Ping timeout: 255 seconds]
markong has joined #ruby
rvalue has joined #ruby
cognemo has quit [Quit: ZNC 1.8.2 - https://znc.in]
cognemo has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.7.1]
<leftylink> pandabot: rb //.source.class
<pandabot> String - https://carc.in/#/r/ebte
<leftylink> it's just a string. String#delete deletes characters, not substrings
<leftylink> pandabot: ri String#delete
perrierjouet has joined #ruby
tomtmym has quit [Quit: Gone.]
<henk> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('\\Az')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> henk: # => too short escape sequence: /\((?x-mi:0 ...check link for more (https://carc.in/#/r/ebth)
<henk> leftylink: yeah, I got that, but I fail to properly understand the argument to delete(), it seems. \\\Az is one escaped backslash, one escaped 'A' and a 'z', right? why is the A escaped but not the z?
<henk> '\\\A\z' seems to make sense. '\\Az' is one escaped backslash, and the plain letters 'A' and 'z'. I’d expect that to work as well but it doesn’t and I don’t understand why …
<leftylink> > Uses the same rules for building the set of characters as String#count.
<leftylink> pandabot: ri String#count
rvalue has quit [Quit: ZNC - https://znc.in]
<henk> huh, ok, I was reading 3.2.0 docs which don’t mention the count thing … but I’m actually using 2.7.0
<henk> in any case: the count docs don’t yet make it clearer to me. since ruby[bot] is using 3.0 and behaves as my 2.7, I don’t think reading 2.7 docs will help either
<weaksauc_> if you do Az\\ it will remove those
<weaksauc_> something about \\ being at the start causes an issue
<henk> oooh
<leftylink> the 2.7.0 docs already said it
<leftylink> > The backslash character \ can be used to escape ^ or - and is otherwise ignored unless it appears at the end of a sequence or the end of a other_str.
<leftylink> I can lead the horse to water, but I can't make it drink
<weaksauc_> reading that shows nothing
<henk> leftylink: but … it’s not ignored‽ if it was ignored, wouldn’t '\\\A\z' be the same as 'Az'?
<leftylink> what makes you think it isn't?
<henk> >> require 'resolv'; reg = Regexp.new(Resolv::IPv4::Regex.source.delete('Az')); "foo bar 192.168.0.1 blah"[reg]
<ruby[bot]> henk: # => too short escape sequence: /\((?x-mi:0 ...check link for more (https://carc.in/#/r/ebtr)
<weaksauc_> >> Resolv::IPv4::Regex.source.delete('Az') == Resolv::IPv4::Regex.source.delete('\\\Az')
<henk> it’s used to remove the backslashes in the regex escaping 'A' and 'z' to make them anchors and just leaving them out means they are kept in the regex while the thing they escape (A and z) are removed, breaking the regex …
<weaksauc_> >> require 'resolv'; Resolv::IPv4::Regex.source.delete('Az') == Resolv::IPv4::Regex.source.delete('\\\Az')
<weaksauc_> anyhoo that's false
<leftylink> okay you are right, the situations where it's ignored were not described correctly
<leftylink> pandabot rb [?\\.delete('\\\A'), ?\\.delete('\\A'),]
<pandabot> ["", "\\"] - https://carc.in/#/r/ebtu
<weaksauc_> yeah it's poorly documented i'd say
rvalue has joined #ruby
<leftylink> pandabot: rb [(1..5).map { ?\\.delete(?\\*_1) }, (1..5).map { ?\\.delete(?\\*_1+?A) }]
<pandabot> [["", "", "", "", ""], ["\\", "", "", "", ""]] - https://carc.in/#/r/ebtv
<leftylink> oh also worth noting
<leftylink> pandabot: rb [a='\A'.chars, b='\\A'.chars, a == b]
<pandabot> [["\\", "A"], ["\\", "A"], true] - https://carc.in/#/r/ebtx
<henk> leftylink: IIUC you are currently testing one case that’s still a bit unclear, correct? or are those commands that should make things clearer for me? because this seems to be the one case I still don’t understand … all other variants mentioned seem clear now.
<henk> uuuuh
<henk> o_O that seems strange, to say the least … WTF? not even sure what to ask :D
<leftylink> I don't really like it, but I didn't make the rules
<henk> ok, so we have working: 'Az\\', 'A\\\z', and '\\\Az'
<henk> and non-working: 'Az\\\', 'A\\z', and '\\Az'
otisolsen70 has quit [Quit: Leaving]
<henk> that doesn’t seem to make sense and not really match the description, does it? seems like a bug to me. at least in the docs that they don’t warn about this properly, right?
<leftylink> the docs were wrong to say that it is ignored. they should have instead simply said that \ is the escape character, full stop.
<leftylink> at least the new docs in https://github.com/ruby/ruby/blob/master/doc/character_selectors.rdoc do it better
<leftylink> it's worse when you have to contend with escape sequences in both the language level (in the string literal) and in the library level (in how the functions interpret a particular sequence of character). but I suppose using single quotes is helping not make mistakes in the former
<henk> well, yes, better, but it’s still not comprehensive and coherent …
<henk> it’s not clear why '\\Az' does not work and '\\\Az' does … or in other words, taking examples from the linked docs: why does "hello\r\nworld".delete("\\r") remove the single r, but not the escaped r and not the backslashes? why does "hello\r\nworld".delete("\\\r") remove the \r but not the backslash of \n?
<leftylink> because there is not "a backslash of \n"
<leftylink> there is a newline character
<leftylink> "hello\r\nworld" does not contain any backslashes.
<leftylink> pandabot: rb chars "\\\r"
<pandabot> stderr: -e:2:in `<main>': undefined method `chars' for main:Object (NoMethodError) - exit 1 - https://carc.in/#/r/ebu5
<leftylink> pandabot: rb "\\\r".chars
<pandabot> ["\\", "\r"] - https://carc.in/#/r/ebu6
<leftylink> so delete("\\\r") says delete backslashes or carriage returns, and "hello\r\nworld" contains a carriage return that is deleted
<henk> ah, ok, fair.
<leftylink> but we should talk about '\\Az' and '\\\Az'
<leftylink> pandabot: rb ['\\Az'.chars, '\\\Az'.chars]
<pandabot> [["\\", "A", "z"], ["\\", "\\", "A", "z"]] - https://carc.in/#/r/ebu7
<henk> but the same way of thought does not work with the anchors \A and \z AFAICT …
<leftylink> pandabot: rb [?\\.delete('\\Az'), ?\\.delete('\\\Az')]
<pandabot> ["\\", ""] - https://carc.in/#/r/ebu8
<henk> hrm /me needs to think about that
<leftylink> so, we see this
<leftylink> when delete sees \Az, it says delete two characters: the character designated by the escape sequence \A, and the character z
<leftylink> the character designated by the escape sequence \A is A
<leftylink> so it deletes A and z, deleting no backslashes
rvalue has quit [Ping timeout: 268 seconds]
<leftylink> with .delete('\\\Az'), delete sees \\Az, so it will delete three characters: the character designated by the escape sequence \\, A, and z. the character designated by the escape sequence \\ is \, so it deletes backslashes, A, and z
<leftylink> pandabot rb [src = /\A\z/.source, a = '\\Az', src.delete(a), b = '\\\Az', src.delete(b)].map(&:chars)
<pandabot> [["\\", "A", "\\", "z"], ["\\", "A", "z"], ["\\", "\\"], ["\\", "\\", "A", "z"], []] - https://carc.in/#/r/ebug
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
<henk> woah, ok, I need to go get some sleep and then think about that again …
<henk> leftylink, weaksauc_: thanks for your inputs!
desnudopenguino has joined #ruby
dionysus69 has joined #ruby