adam12 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 | Logs: https://libera.irclog.whitequark.org/ruby/
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
markong has quit [Ping timeout: 252 seconds]
yosafbridge has quit [Ping timeout: 252 seconds]
yosafbridge has joined #ruby
Rounin has quit [Ping timeout: 246 seconds]
ur5us has joined #ruby
jpn has joined #ruby
markong has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
markong has quit [Ping timeout: 248 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 248 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 246 seconds]
favadi has joined #ruby
darkstarx has quit [Remote host closed the connection]
darkstarx has joined #ruby
Sankalp has quit [Ping timeout: 246 seconds]
Sankalp has joined #ruby
ur5us has quit [Ping timeout: 255 seconds]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 248 seconds]
ur5us has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
favadi has joined #ruby
goldfish has quit [Ping timeout: 255 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 248 seconds]
cocalero_ has joined #ruby
cocalero_ has quit [Quit: Going offline, see ya! (www.adiirc.com)]
ur5us has quit [Ping timeout: 255 seconds]
D_A_N has quit [Quit: leaving]
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
c10l has quit [Quit: See ya! o/]
c10l has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
favadi has joined #ruby
otisolsen70 has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
otisolsen70 has quit [Remote host closed the connection]
otisolsen70 has joined #ruby
ur5us has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
favadi has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
cartdrige has joined #ruby
jetchisel has joined #ruby
crax23 has quit [Ping timeout: 248 seconds]
fandre1986 has joined #ruby
wand has quit [Ping timeout: 258 seconds]
ur5us has quit [Ping timeout: 255 seconds]
reset has quit [Quit: reset]
kerunaru has joined #ruby
CrazyEddy has quit [Ping timeout: 250 seconds]
ur5us has joined #ruby
wand has joined #ruby
cartdrige has quit [Quit: Leaving]
grokify has quit [Remote host closed the connection]
teclator has joined #ruby
jidar has quit [Read error: Software caused connection abort]
jidar has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 255 seconds]
Vonter has quit [Ping timeout: 272 seconds]
Vonter has joined #ruby
otisolsen70_ has joined #ruby
otisolsen70 has quit [Ping timeout: 252 seconds]
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
rhe has quit [Ping timeout: 248 seconds]
Vonter has quit [Ping timeout: 255 seconds]
dionysus69 has joined #ruby
Vonter has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 255 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #ruby
jpn has joined #ruby
kerunaru has quit [Ping timeout: 255 seconds]
kerunaru has joined #ruby
ccapndave has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 246 seconds]
kerunaru has quit [Ping timeout: 252 seconds]
kerunaru has joined #ruby
ccapndave has quit [Quit: Textual IRC Client: www.textualapp.com]
Vonter has quit [Ping timeout: 252 seconds]
walez has joined #ruby
gonix has joined #ruby
walez___ has joined #ruby
walez has quit [Ping timeout: 252 seconds]
dionysus69 has quit [Ping timeout: 255 seconds]
ur5us has quit [Ping timeout: 255 seconds]
kerunaru has quit [Ping timeout: 252 seconds]
kerunaru has joined #ruby
jidar has quit [Ping timeout: 252 seconds]
jidar has joined #ruby
jhawthorn has quit [Quit: ZNC 1.8.2 - https://znc.in]
jhawthorn has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
royo25 has joined #ruby
fandre1986 has quit [Quit: Connection closed]
otisolsen70__ has joined #ruby
gonix has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
otisolsen70_ has quit [Ping timeout: 252 seconds]
seisatsu has quit [Read error: Software caused connection abort]
grokify has joined #ruby
Vonter has joined #ruby
seisatsu has joined #ruby
grokify has quit [Ping timeout: 255 seconds]
Furai has quit [Quit: WeeChat 3.7.1]
aeris has quit [*.net *.split]
Aminda has quit [*.net *.split]
wand has quit [*.net *.split]
kinduff has joined #ruby
Vonter has quit [Ping timeout: 252 seconds]
dionysus69 has joined #ruby
Vonter has joined #ruby
Furai has joined #ruby
kerunaru has quit [Ping timeout: 272 seconds]
kerunaru has joined #ruby
rhe has joined #ruby
willfish has joined #ruby
hrberg has quit [Ping timeout: 276 seconds]
kerunaru has quit [Ping timeout: 248 seconds]
Al2O3 has quit [Ping timeout: 250 seconds]
kerunaru has joined #ruby
kerunaru has quit [Read error: Connection reset by peer]
Al2O3 has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
kerunaru has joined #ruby
nemesit has quit [Read error: Software caused connection abort]
nemesit has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
dionysus69 has joined #ruby
kerunaru has quit [Quit: leaving]
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
dionysus70 is now known as dionysus69
depesz has joined #ruby
kerunaru has joined #ruby
jpn has quit [Ping timeout: 255 seconds]
dionysus70 has joined #ruby
royo25 has quit [Ping timeout: 252 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
dionysus70 is now known as dionysus69
markong has joined #ruby
cahoots has quit [Quit: leaving]
royo25 has joined #ruby
jpn has joined #ruby
kerunaru has quit [Ping timeout: 252 seconds]
kerunaru has joined #ruby
<depesz> hi. it seems that when I try to install gem with version specified like '>= something', and I already have newest version installed, the gem is temporarily made not available.
<depesz> we see it when installing gem via ansible, and having script that runs from cron every 5 minuets, sometimes, when the timing is just right, we get require fail because gem "disappears" temporarily.
jpn has quit [Ping timeout: 248 seconds]
jpn has joined #ruby
<depesz> is there anything we can do, other than retry require after a second or so?
willfish has quit [Quit: WeeChat 3.6]
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
<depesz> so, i can replicate it by having z.rb that is: https://gist.github.com/depesz/627eb55ff15fa5e09fa7110864d39f2e and running in 2 shells: 1. while true; do ./z.rb; done 2. while true; do gem install -v '>= 1.0.0' progressbar; done
<depesz> usually it works, but sometimes, it just hits "the right timing" and z.rb fails with "internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- progressbar (LoadError)"
grokify has joined #ruby
kerunaru has quit [Ping timeout: 272 seconds]
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
D_A_N has joined #ruby
FetidToot9 has joined #ruby
grokify has quit [Ping timeout: 276 seconds]
FetidToot has quit [Ping timeout: 272 seconds]
FetidToot9 is now known as FetidToot
kerunaru has joined #ruby
rvalue has quit [Quit: ZNC - https://znc.in]
rvalue has joined #ruby
jpn has quit [Ping timeout: 252 seconds]
grokify has joined #ruby
jpn has joined #ruby
grokify has quit [Remote host closed the connection]
jpn has quit [Ping timeout: 252 seconds]
grokify has joined #ruby
<adam12> depesz: What do you call to install the gem?
<depesz> gem install -v '>= ...' gemname
<depesz> adam12: i actuyally showed it 2 lines above
grokify has quit [Ping timeout: 246 seconds]
<adam12> depesz: The only thing I can think of is two stages; determine latest gem version & check if it needs installing, and then install if it does.
<depesz> yeah, isn't as nice.
kerunaru has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
_aeris_ has joined #ruby
Aminda has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
wand has joined #ruby
jpn has quit [Ping timeout: 255 seconds]
royo25 has quit [Ping timeout: 252 seconds]
royo25 has joined #ruby
sam113101 has quit [Read error: Software caused connection abort]
sam113101 has joined #ruby
dionysus69 has joined #ruby
pyrex has quit [Read error: Software caused connection abort]
pyrex has joined #ruby
ccapndave has joined #ruby
some14u has joined #ruby
otisolsen70__ has quit [Quit: Leaving]
otisolsen70 has joined #ruby
eddof13 has joined #ruby
grokify has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcd has quit [Remote host closed the connection]
Guest9768 has quit [Read error: Software caused connection abort]
jpn has joined #ruby
grokify has quit [Remote host closed the connection]
Guest9768 has joined #ruby
desnudopenguino1 has joined #ruby
Laplace has joined #ruby
desnudopenguino has quit [Ping timeout: 255 seconds]
desnudopenguino1 is now known as desnudopenguino
<Laplace> Hi folks -- I have a class which has an instance variable that is a hash. I essentially want the class to wrap the hash such that `class_instance.to_h` returns the hash rather than including other instance variables of the class instance. I've successfully overriden to_h because that one is a bit trivial.
<Laplace> However, I am not sure what the best way to override to_json and as_json is. How can I ensure those don't include things that are nt in the hash?
<Laplace> to_json and as_json allow for an `options` variable to be passed which has some nicities I want to keep. I just don't want the returned hash/string to include stuff of the class that's not in the wrapped hash
<Laplace> I saw that `as_json` eventually called `serializable_hash` and maybe that's an oppertunity to override but not sure if that's the best way. The other alternative would be to do super and do dict-reject. However, my hash can be recursive so not sure how bad this will be
<adam12> Laplace: Do you have any code?
<adam12> as_json is a Rails-ism. Are you using Rails?
<Laplace> I'll prep an example that is similar to my use case
favadi has joined #ruby
favadi has quit [Client Quit]
<adam12> Oh interesting. as_json is actually in Ruby stdlin.
<adam12> TIL
<adam12> s/stdlin/stdlib
Al2O3 has quit [Ping timeout: 255 seconds]
ccapndave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Laplace> adam12: Here's an examle https://pastebin.com/kVLeh7xn I delegated to_h to my dict so it works as I expect, but as_json and to_json overriding might not be that simple. they allow for filtering options that I might want to keep. https://apidock.com/rails/ActiveRecord/Serialization/to_json
<Laplace> So far, my best bet is doing `super` for both and doing something like this https://stackoverflow.com/a/4928824 to find the difference and remove it from the returned value
thecliguy has quit [Read error: Software caused connection abort]
<adam12> Laplace: What about just defining your own `as_json`? def as_json(opts = {}); @data.as_json(opts); end
<Laplace> *facepalm*
<adam12> Could probably just delegate it too, if you wanted.
<adam12> delegate :as_json, to: :data
heartburn has quit [Read error: Software caused connection abort]
heartburn has joined #ruby
thecliguy has joined #ruby
goldfish has joined #ruby
royo25 has quit [Quit: Bye]
Al2O3 has joined #ruby
<Laplace> adam12: That's fantastic, worked as expected. Thank you so much!
<adam12> Laplace: Cheers.
Vonter has quit [Ping timeout: 272 seconds]
CrazyEddy has joined #ruby
wra1th has joined #ruby
Vonter has joined #ruby
Davidian has quit []
gr33n7007h has quit [Ping timeout: 276 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
eddof13_ has joined #ruby
goldfish_ has joined #ruby
<_73> I am trying to use rspec's `with` method for matching arguments. However I am not able to say something like `receive(:foo).with(instance_of(MyClass) => :bar, instance_of(MyClass) => :baz)`, presumably because when the argument is a hash I cannot nest other matchers. How can I test that a method is called with a hash argument where the keys are instances of some class? I have reproduced the problem here: http://dpaste.com/F3HDLZWTE
walez___ has quit [Ping timeout: 255 seconds]
goldfish has quit [Ping timeout: 252 seconds]
eddof13_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
sam113102 has joined #ruby
sam113101 has quit [Read error: Connection reset by peer]
sam113102 is now known as sam113101
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> _73: Maybe you can use hash_including(your original code)
<adam12> _73: I havent' used rspec in a long time so i am not sure.
<adam12> hash_including(instance_of(IO) => :read, instance_of(IO) => :write)
reset has joined #ruby
<_73> I have tried this and unfortunately it does not work. Here is the same example failing with `hash_including`: http://dpaste.com/HN6ZUYX3R
<adam12> _73: Ruby version?
<_73> ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]
<adam12> Actually, that doesn't matter here.
<_73> rspec 3.11
___nick___ has joined #ruby
<adam12> Instead of instance_of(IO), can you use an anything matcher?
<adam12> anything => :read, anything => :write
<adam12> I just wonder if it's not actually an IO instance, but some sort of singleton.
<_73> No, it fails with anything as well
<adam12> And flatargs passes anyways, so it can't be that. Hmm.
Vonter has quit [Ping timeout: 248 seconds]
Vonter has joined #ruby
Guest9768 has quit [Ping timeout: 252 seconds]
Guest9768 has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
wra1th has quit [Quit: wra1th]
dionysus69 has quit [Ping timeout: 252 seconds]
eddof13 has quit [Ping timeout: 252 seconds]
jpn has quit [Ping timeout: 246 seconds]
sam113102 has joined #ruby
sam113101 has quit [Ping timeout: 252 seconds]
sam113102 is now known as sam113101
cartdrige has joined #ruby
TomyWork has quit [Remote host closed the connection]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 248 seconds]
BeverlyBot has joined #ruby
markong has quit [Ping timeout: 255 seconds]
eddof13 has joined #ruby
gr33n7007h has joined #ruby
Vonter has quit [Ping timeout: 252 seconds]
peder has quit [Ping timeout: 276 seconds]
Vonter has joined #ruby
peder has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 248 seconds]
crax23 has quit [Quit: Leaving]
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
<leftylink> ever had sensible/understandable code that uses an `else` to an `unless`?
<sam113101> leftylink: I don't think that's even allowed?
<leftylink> sure it is
<sam113101> I read it's not
<leftylink> pandabot: rb unless 1; :a; else :b end
<leftylink> then you can read that then
<BeverlyBot> Sounds dangerous
victori has joined #ruby
<sam113101> leftylink: my bad, it's elsif that you can't use with unless
cocalero_ has joined #ruby
cocalero_ has quit [Client Quit]
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #ruby
<adam12> I'd rather see unless only in postfix form, but if it's with an `else` I'd almost 100% ask for a rewrite. Because I've never seen it paired well.
<BeverlyBot> hmmm
<adam12> If it's a super simple predicate call in block form, I'll generally allow it.
<adam12> but if you include an and/or operator I'm not having it.
<BeverlyBot> lol
<adam12> weaksauce: Uh oh. I wonder if that means Ruby is next.
<weaksauce> wouldn't surprise me adam12
<adam12> I'm starting to archive all rubygems source code. I wonder if there'd be any reasonable way to detect these things.
<adam12> Could start with some custom clamav rules possibly.
<BeverlyBot> hmm..
gr33n7007h has quit [Read error: Connection reset by peer]
<BeverlyBot> Sounds scary, didnt know this was a thing
<weaksauce> they've been worrying about these kinds of attacks
<weaksauce> popular gems getting 2fa
<BeverlyBot> aaah yeah
<BeverlyBot> If I was a virus writer I would definitely try something like that
<weaksauce> i was listening to the darknet diaries yesterday about the REvil ransomware thing
<weaksauce> they pulled in some serious coin
<BeverlyBot> hmm
<BeverlyBot> will check it out, thanks
<adam12> weaksauce: Hey! I was listening to that too, a few days ago.
<adam12> But I switched gears last night and was listening to Bryan Cantrill on the ACM podcast.
<BeverlyBot> its been years since i was into that stuff, but used to collect rare old research viruses. huge fan of http://virus.wikidot.com/29a (although they probably hate my guts :P)
grokify has joined #ruby
<adam12> BeverlyBot: I used to enjoy browsing Astalavista.
grokify has quit [Ping timeout: 272 seconds]
<adam12> Does anybody have Huginn deployed? I keep meaning to try it for something but curious if anybody else is using it.
<BeverlyBot> heheh man! I remember it now, yeah it was nice!
jpn has joined #ruby
Laplace has quit [Quit: Connection closed for inactivity]
gr33n7007h has joined #ruby
aeris- has joined #ruby
_aeris_ has quit [Remote host closed the connection]
grokify has joined #ruby
dionysus69 has joined #ruby
_ht has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
ur5us has joined #ruby
aeris- is now known as aeris
eddof13 has quit [Ping timeout: 252 seconds]
grokify has quit [Remote host closed the connection]
Vonter has quit [Ping timeout: 252 seconds]
Vonter has joined #ruby
some14u has joined #ruby
some14u- has joined #ruby
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
some14u- has quit [Client Quit]
some14u has quit [Ping timeout: 252 seconds]
grokify has quit [Ping timeout: 268 seconds]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has quit [Ping timeout: 248 seconds]
<sam113101> so what is w4sp stealer?
phryk has quit [Quit: ZNC 1.8.2 - https://znc.in]
wand has quit [Write error: Connection reset by peer]
jpn has quit [Ping timeout: 255 seconds]
_whitelogger has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
goldfish_ has quit [Quit: Leaving]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 255 seconds]
desnudopenguino1 is now known as desnudopenguino
stirl has joined #ruby
hrberg has joined #ruby
hrberg has quit [Client Quit]
hrberg has joined #ruby
hrberg has quit [Client Quit]
hrberg has joined #ruby
hrberg has quit [Client Quit]
hrberg has joined #ruby
hrberg has quit [Client Quit]
hrberg has joined #ruby
hrberg has quit [Client Quit]
hrberg has joined #ruby
croberts has quit [Read error: Software caused connection abort]
phryk has joined #ruby
croberts has joined #ruby
markong has joined #ruby
jpn has joined #ruby
phryk has quit [Quit: ZNC 1.8.2 - https://znc.in]
jpn has quit [Ping timeout: 252 seconds]
gr33n7007h has quit [Quit: WeeChat 3.7.1]
gr33n7007h has joined #ruby
jpn has joined #ruby
otisolsen70 has quit [Quit: Leaving]
zoknert has joined #ruby
stirl has quit [Ping timeout: 255 seconds]
trunasx has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
trunasx has quit [Client Quit]
vigumnov has joined #ruby
zoknert has quit [Ping timeout: 246 seconds]
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
Vonter has quit [Ping timeout: 252 seconds]
Vonter has joined #ruby
NightMonkey has quit [Read error: Software caused connection abort]
gr33n7007h has joined #ruby
NightMonkey has joined #ruby
matoro has quit [Read error: Software caused connection abort]
wand has quit [Remote host closed the connection]
matoro has joined #ruby
matoro has joined #ruby
matoro has quit [Changing host]
wand has joined #ruby
finsternis has quit [Read error: Connection reset by peer]
jpn has quit [Ping timeout: 248 seconds]
hrberg has quit [Ping timeout: 252 seconds]
hrberg has joined #ruby
svdasein has quit [Ping timeout: 260 seconds]
svdasein has joined #ruby
jpn has joined #ruby