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]
<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 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>
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>
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.
<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.