havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
x0f_ has quit [Ping timeout: 265 seconds]
ChmEarl has quit [Quit: Leaving]
x0f has joined #ruby
dasher00 has quit [Ping timeout: 240 seconds]
x0f_ has joined #ruby
x0f has quit [Ping timeout: 265 seconds]
alexherbo24 has joined #ruby
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo24 is now known as alexherbo2
x0f has joined #ruby
x0f_ has quit [Ping timeout: 240 seconds]
x0f_ has joined #ruby
x0f has quit [Ping timeout: 244 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
<adam12> rapidwave: What's the rest of the output?
orbyt_ has joined #ruby
imode has joined #ruby
Azure has quit [Ping timeout: 246 seconds]
Azure has joined #ruby
x0f_ has quit [Ping timeout: 240 seconds]
x0f has joined #ruby
TCZ has quit [Quit: Leaving]
sgen has quit [Ping timeout: 258 seconds]
x0f_ has joined #ruby
cuerbot has quit [Read error: Connection reset by peer]
x0f has quit [Ping timeout: 264 seconds]
elcuervo has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
mangoicedtea has quit [Quit: Leaving]
chalkmon1 has joined #ruby
mnathani has quit [Remote host closed the connection]
mnathani has joined #ruby
chalkmonster has quit [Ping timeout: 256 seconds]
ur5us has joined #ruby
Rudd0 has quit [Remote host closed the connection]
chouhoulis has quit [Remote host closed the connection]
cliluw has joined #ruby
alexherbo2 has quit [Remote host closed the connection]
braincrash has quit [Quit: bye bye]
Dara has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
Dara has joined #ruby
gix has quit [Ping timeout: 240 seconds]
Dara has quit [Remote host closed the connection]
cloaked1 has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
cow[moo] has joined #ruby
adu has joined #ruby
drincruz has joined #ruby
bhaak has quit [Ping timeout: 240 seconds]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 264 seconds]
roshanavand_ is now known as roshanavand
Rudd0 has joined #ruby
jokester has quit [Ping timeout: 260 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wburke00 has joined #ruby
wburke00 has left #ruby [#ruby]
cthulchu_ has quit [Ping timeout: 264 seconds]
chouhoulis has joined #ruby
x0f_ has quit [Ping timeout: 240 seconds]
x0f has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
cliluw has quit [Ping timeout: 264 seconds]
ho0po3 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Dara has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
bhaak has joined #ruby
kashike has joined #ruby
ho0po3 has quit [Read error: Connection reset by peer]
ho0po3 has joined #ruby
ho0po3 has quit [Client Quit]
cliluw has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
TzilTzal has joined #ruby
rapidwave has quit [Quit: Konversation terminated!]
bocaneri has joined #ruby
cliluw has quit [Ping timeout: 244 seconds]
cliluw has joined #ruby
johnny56 has quit [Ping timeout: 258 seconds]
chalkmonster has joined #ruby
chalkmon1 has quit [Ping timeout: 258 seconds]
cliluw has quit [Ping timeout: 258 seconds]
cliluw has joined #ruby
johnny56 has joined #ruby
johnny56 has quit [Ping timeout: 256 seconds]
chalkmon1 has joined #ruby
chalkmonster has quit [Ping timeout: 264 seconds]
Rudd0 has quit [Ping timeout: 240 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 264 seconds]
johnny56 has joined #ruby
cgfbee has joined #ruby
snickers has joined #ruby
johnny56 has quit [Ping timeout: 258 seconds]
akem has joined #ruby
drale2k has joined #ruby
johnny56 has joined #ruby
drale2k has quit [Client Quit]
adu has quit [Quit: adu]
johnny56 has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
roadt__ has joined #ruby
roadt_ has quit [Ping timeout: 258 seconds]
FetidToot has quit [Ping timeout: 265 seconds]
johnny56 has quit [Ping timeout: 258 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
cliluw has quit [Ping timeout: 264 seconds]
johnny56 has joined #ruby
FetidToot has joined #ruby
<TzilTzal> Does anyone know how to support class reloading? I have a non-rails class that doesn't seem to get reloaded when other classes do...
johnny56 has quit [Ping timeout: 240 seconds]
xco has joined #ruby
drale2k has joined #ruby
<jhass> what makes a class a "rails class"? :D
imode has quit [Ping timeout: 264 seconds]
<jhass> For Rails in the default config, it's important where the file is. Check the autoload_paths and eager_load_paths configs
<jhass> then it's also really important that the file to constant naming convention is held
<jhass> including the folders for the namespace modules
skape has quit [Quit: Connection closed for inactivity]
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has joined #ruby
johnny56 has joined #ruby
elphe has quit [Client Quit]
elphe has joined #ruby
cd has quit [Quit: cd]
johnny56 has quit [Ping timeout: 258 seconds]
gueorgui has quit [Ping timeout: 265 seconds]
<TzilTzal> jhass: adding the directory to autoload_paths didn't solve this.. it didn't get reloaded when changed.
<jhass> I think I gave you many many more pointers than that. Also given you didn't give any of the lacking information to troubleshoot this, I cannot help you further
<TzilTzal> I also tried config.file_watcher - this indeed restarts the server upon change (so I know it's watched), but I don't see the changes reflected. It's as-if my class hasn't really reloaded.
johnny56 has joined #ruby
drale2k has joined #ruby
braincra- has joined #ruby
braincrash has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
mnathani has quit [Remote host closed the connection]
mnathani has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
ctOS has quit [Quit: Connection closed for inactivity]
fowl_ has quit [Read error: Connection reset by peer]
en10n has quit [Ping timeout: 246 seconds]
ReinH has quit [Read error: Connection reset by peer]
timwis has quit [Ping timeout: 272 seconds]
johnny56 has joined #ruby
kwilczynski has quit [Ping timeout: 260 seconds]
grvgr has quit [Read error: Connection reset by peer]
d0liver has quit [Ping timeout: 272 seconds]
ReinH has joined #ruby
en10n has joined #ruby
grvgr has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
fowl_ has joined #ruby
timwis has joined #ruby
kwilczynski has joined #ruby
jerme_ has quit [Ping timeout: 265 seconds]
jerme_ has joined #ruby
d0liver has joined #ruby
johnny56 has joined #ruby
tumdum has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
code_zombie has quit [Quit: Leaving]
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dasher00 has joined #ruby
johnny56 has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
snickers has quit [Remote host closed the connection]
ur5us has joined #ruby
mnathani has quit [Remote host closed the connection]
mnathani has joined #ruby
FetidToot has quit [Ping timeout: 240 seconds]
ap4y has quit [Ping timeout: 260 seconds]
ellcs has joined #ruby
johnny56 has joined #ruby
FetidToot has joined #ruby
johnny56 has quit [Ping timeout: 256 seconds]
ellcs has quit [Ping timeout: 256 seconds]
ellcs has joined #ruby
TomyWork has joined #ruby
johnny56 has joined #ruby
greengriminal has joined #ruby
drale2k has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
postmodern has quit [Quit: Leaving]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
Rudd0 has joined #ruby
johnny56 has joined #ruby
<IsoLinCHiP> Any suggestions for convenient gem to handle user preferences in a CLI app? Something that takes care of XDG stuff, environment var overrides and maybe even validation and just gives me a hash?
ellcs has quit [Ping timeout: 265 seconds]
<IsoLinCHiP> With my search terms I was mostly finding gems that are intended for webapps and rails/rake env's.
<IsoLinCHiP> rake=rack
johnny56 has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
kinduff has quit [Ping timeout: 246 seconds]
johnny56 has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
chouhoulis has joined #ruby
gueorgui has joined #ruby
darkstardev13 has joined #ruby
darkstardevx has quit [Ping timeout: 240 seconds]
snickers has joined #ruby
kinduff has joined #ruby
chouhoulis has quit [Ping timeout: 258 seconds]
snosk8r has joined #ruby
darkstardev13 has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 240 seconds]
TzilTzal has quit [Quit: Leaving.]
kinduff has quit [Ping timeout: 265 seconds]
ellcs has joined #ruby
fercell has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure|dc has joined #ruby
Azure has quit [Ping timeout: 246 seconds]
mnathani_ has joined #ruby
mnathani has quit [Ping timeout: 240 seconds]
cow[moo] has joined #ruby
mnathani_ has quit [Read error: Connection reset by peer]
mnathani has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
drincruz has joined #ruby
cow[moo] has quit [Client Quit]
Rudd0^ has joined #ruby
renosis has joined #ruby
cow[moo] has joined #ruby
Rudd0 has quit [Ping timeout: 246 seconds]
mnathani has quit [Read error: Connection reset by peer]
mnathani has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
coltkirk has joined #ruby
renosis has quit [Remote host closed the connection]
stryek has joined #ruby
ap4y has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
cow[moo] has joined #ruby
Itsame1 has joined #ruby
Itsame1 has quit [Client Quit]
kent\n has quit [Quit: No Ping reply in 180 seconds.]
kent\n has joined #ruby
TCZ has joined #ruby
ap4y has quit [Ping timeout: 265 seconds]
chalkmonster has joined #ruby
chalkmon1 has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
TCZ has joined #ruby
drale2k has joined #ruby
dualfade has quit [Read error: Connection reset by peer]
MadLamb has joined #ruby
<MadLamb> I'm trying to use https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-dsl to build a query where many parameters are optional depending on how they are configured on the front end. I'm facing the problem that eventually none of the parameters are provided, but this lib still generates a empty query, which is considered invalid by elasticsearch. I dont want to add an if with all the conditions. Any smarter way to do that?
dualfade has joined #ruby
Scient has quit [Ping timeout: 260 seconds]
Scient has joined #ruby
sgen has joined #ruby
renosis has joined #ruby
<renosis> Anyone know how to set a net/http Get timeout lower? It is currently set at 10 secs, I want 2 secs. I am trying to adjust read_timeout attribute, but it doesn't seem to change anything
<jhass> maybe you're running into the connect timeout, write timeout or the dns resolution timeout instead
<renosis> Oh, that's a good point
chalkmon1 has joined #ruby
chalkmonster has quit [Ping timeout: 265 seconds]
johnny56 has quit [Quit: johnny56]
rapidwave has joined #ruby
rapidwave has joined #ruby
rapidwave has quit [Changing host]
renosis has quit [Quit: Connection closed]
<adam12> IsoLinCHiP: tty-config?
<adam12> IsoLinCHiP: I don't think it will deal with XDG tho; you'd have to provide the paths yourself.
<adam12> MadLamb: Docs show `definition = search {}`, with `definition.to_h` containing a `query` key. Can you not guard on that?
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmon1 has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
<apotheon> Huh . . . tty-config seems really nice.
impermanence has quit [Quit: Connection closed]
snickers has quit [Quit: Textual IRC Client: www.textualapp.com]
drale2k has joined #ruby
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
impermanence has joined #ruby
kinduff has joined #ruby
kent\n has quit [Ping timeout: 240 seconds]
<apotheon> tty-config seems quite nice to use, after playing with it in irb
fercell has quit [Quit: WeeChat 2.8]
<adam12> Yeah. I use it in a few projects. tty-prompt and tty-logger are also common for many of my projects.
<adam12> the whole tty ecosystem is quiet nice.
SeepingN has joined #ruby
<apotheon> seems that way
<apotheon> Thanks for mentioning it.
kent\n has joined #ruby
alexherbo2 has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
chouhoulis has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.9]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
chalkmonster has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<MadLamb> omg lost a lot of time because I added a require and an import on top of the file and for some reason even when I remove the code remais active
<MadLamb> what kind of bs is that
ChmEarl has joined #ruby
<apotheon> IsoLinCHiP: Use the tty-config gem with the xdg gem, I guess.
<apotheon> I'm curious about the name IsoLinCHiP . . .
<apotheon> Does that mean International Standards Organization Linux California Highway Patrol?
<apotheon> . . . or maybe Isometric Linux California Highway Patrol?
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
<rapidwave> Is ChRuby NOT intended for Windows?
dionysus69 has quit [Remote host closed the connection]
akem has quit [Ping timeout: 265 seconds]
rapidwave has left #ruby ["Konversation terminated!"]
TCZ has quit [Quit: Leaving]
<IsoLinCHiP> adam12, apotheon : ahh, yes the tty gems are truely gems, thanks for the suggestion.
<IsoLinCHiP> apotheon: in what way
x0n- has quit [Ping timeout: 265 seconds]
x0n has joined #ruby
drale2k has joined #ruby
akem has joined #ruby
impermanence has quit [Ping timeout: 260 seconds]
dead10cc has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
Dara has quit [Ping timeout: 240 seconds]
coltkirk has quit [Ping timeout: 258 seconds]
Dara has joined #ruby
alexherbo2 has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
kiwi_66 has joined #ruby
<kiwi_66> Hello, newbie question: what's the difference between "@doc = Nokogiri::XML" and "doc = Nokogiri::XML" ?
<kiwi_66> Apparently, "@doc" is an instance variable, but how does it differ from plain "doc"?
<kiwi_66> Thank you.
<apotheon> scope
alexherbo23 has joined #ruby
<kiwi_66> So it makes no difference if "doc" is only used in a single, end-user script, as opposed to a script that creates a new class derived from a parent class?
<apotheon> kiwi_66: I haven't exhaustively read this page, but it seems to describe different variable types' scopes for you. https://www.techotopia.com/index.php/Ruby_Variable_Scope
<kiwi_66> I'll read it up. Thanks
<apotheon> This might make the point more quickly: https://www.rubyguides.com/2019/03/ruby-scope-binding/
<apotheon> (and require less JavaScript)
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo23 is now known as alexherbo2
orbyt_ has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> Less JavaScript? Blasphemy.
<apotheon> . . .
SeepingN has quit [Ping timeout: 240 seconds]
<apotheon> I'm a heretic, I guess.
gix has joined #ruby
drale2k has joined #ruby
<kiwi_66> Thank you
kiwi_66 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
cthu| has joined #ruby
zofrex has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmonster has quit [Quit: WeeChat 2.9]
dead10cc has quit [Quit: Konversation terminated!]
<zofrex> I have a Hash of SomeClass => integers, where SomeClass can also be pretty logically compared with a string (each instance has a unique string identifier), and I want to be able to look up the integers with either a SomeClass _or_ a string... is it a really terrible idea to use a refinement to alter String#eql? or #== so that I can make equality between String and SomeClass symmetric, and make Hash
<zofrex> treat them the same as keys?
<Rounin> zofrex: Hmm, that would also affect unrelated parts of the program
<Rounin> zofrex: Might it not be better to make a subclass of the hash?
<Rounin> Or just make a method that does two lookups, or something
<Rounin> Or checks the type of an object, and if it's a SomeClass, it takes the string and looks up using that
skape has joined #ruby
<adam12> Maybe DelegateClass(Hash) then overwrite []. I'm not sure I'd personally overwrite the equality for Classes and Strings...
<zofrex> Rounin: well with a refinement, I -think- I can limit the effect to only the area where I do the lookup?
<zofrex> or am I not understanding the scope of refinements
crowley has joined #ruby
leam has joined #ruby
leitz has joined #ruby
leitz_the_great has joined #ruby
leam has quit [Client Quit]
leitz has quit [Client Quit]
leitz_the_great is now known as leitz
<Rounin> zofrex: I'm not sure what refinements are in this context, but if you can limit it to just the right part of the program, then that seems like a good idea
chalkmonster has joined #ruby
<zofrex> but it's not something I have any experience with
akem has quit [Ping timeout: 240 seconds]
Dara has quit [Remote host closed the connection]
drn97 has joined #ruby
SeepingN has joined #ruby
adu has joined #ruby
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
TomyWork has quit [Remote host closed the connection]
isene has quit [Quit: WeeChat 2.9]
drale2k has joined #ruby
dualfade has quit [Ping timeout: 258 seconds]
akem has joined #ruby
akem has quit [Client Quit]
<adam12> zofrex: When I said DelegateClass, I meant something like this: https://gist.github.com/adam12/35071cf695f95a03339e010115516e55
dualfade has joined #ruby
<adam12> zofrex: It's probably O(n) if passed a String and the Hash is large. If that was a concern you could probably pre-build a lookup table.
<zofrex> I see
<zofrex> is overriding #[] alone sufficient? I'm worried there might be weird behaviour if it's not consistent with other methods
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rippa has joined #ruby
BTRE has quit [Remote host closed the connection]
<adam12> zofrex: No; you'd likely need to override #fetch too if you're using it.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
isene has joined #ruby
orbyt_ has joined #ruby
<MadLamb> adam12, I went into this imperative direction but it doesnt work as it replaces the query every time https://dpaste.org/RGzu
<MadLamb> adam12, I need to append to it
cliluw has joined #ruby
<adam12> MadLamb: Not familiar with the API but you likely need to have one query block and then just conditions in there.
<MadLamb> adam12, this is what I tried before, but those query parameters go inside the query block, if all of them are empty, then the query is empty. but the query still gets defined, so it fails.
<MadLamb> adam12, {} is ok, but {query => {}} is not ok
ujjain2 has joined #ruby
<adam12> MadLamb: You couldn't do something like this? https://gist.github.com/adam12/4be5af803f30d84dfaba98cf3314db6f
cd has joined #ruby
MadLamb has quit [Ping timeout: 265 seconds]
MadLamb has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
<MadLamb> adam12, yes it was missing the query block but that works
<MadLamb> adam12, thanks :D
<adam12> MadLamb: yw!
dviola has quit [Quit: WeeChat 2.9]
bocaneri has quit [Read error: Connection reset by peer]
BrianWGray has joined #ruby
ujjain2 has quit [Ping timeout: 265 seconds]
SeepingN has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
ujjain2 has joined #ruby
akem has joined #ruby
ujjain2 has quit [Client Quit]
BTRE has joined #ruby
powerhouse has quit [Read error: Connection reset by peer]
andremedeiros has quit [Quit: ZNC 1.8.1 - https://znc.in]
andremedeiros has joined #ruby
drale2k has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
cd has quit [Quit: cd]
vondruch has quit [Ping timeout: 260 seconds]
adu has quit [Quit: adu]
akem is now known as RamsesIV
cow[moo] has quit [Ping timeout: 240 seconds]
lacrymology has quit [Ping timeout: 256 seconds]
dviola has joined #ruby
cd has joined #ruby
powerhouse has joined #ruby
adu has joined #ruby
rapidwave has joined #ruby
<rapidwave> I keep getting this message..following the instruction doesn't solve the problem. Ignoring ed25519-1.2.4 because its extensions are not built. Try: gem pristine ed25519 --version 1.2.4
<rapidwave> I'm using Windows 10, if that matters
BTRE has quit [Quit: Leaving]
dees has joined #ruby
leitz has quit [Quit: Leaving]
<adam12> rapidwave: What are you running that generates that message?
selimws has joined #ruby
dualfade has quit [Ping timeout: 265 seconds]
dualfade has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
selimws has quit [Quit: Leaving]
selimws has joined #ruby
selimws has quit [Client Quit]
selimws has joined #ruby
<selimws> hello
CrazyEddy has joined #ruby
SeepingN has joined #ruby
<selimws> is there anyone to help me?
<w10x12> selimws: possibly; ask your question
dualfade has quit [Ping timeout: 240 seconds]
dualfade has joined #ruby
TCZ has joined #ruby
selimws has quit [Remote host closed the connection]
drn97 has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ap4y has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> rapidwave: Show the full error messagE?
<havenwood> rapidwave: What are you running to get this error?
old_relik has joined #ruby
<old_relik> is there a way to write an intersection of a deeply nested hash?
<old_relik> but it only works on 1 level
<havenwood> old_relik: You could cherry pick Hash#deep_merge from ActiveSupport.
<old_relik> hmm
<havenwood> old_relik: require 'active_support/core_ext/hash/deep_merge'
<havenwood> old_relik: Or you could add just that ^ monkey patch as a refinement.
<old_relik> i was thinking of a refinement myself on Hash
<old_relik> but not over deep_merge
<old_relik> not sure if it'll be that useful
<havenwood> old_relik: Ah, sorry, you want *intersection*.
<old_relik> yeah
<old_relik> i'd want deep_intersection or something
<old_relik> i'm wondering what the easiest generic way of traversing a hash map is
<old_relik> until I reach the last level
<old_relik> and apply intersection on each level
<havenwood> old_relik: are you looking for just same key at same level? or what's the rule?
<havenwood> old_relik: same value?
SeepingN has quit [Ping timeout: 240 seconds]
<old_relik> thinking
<old_relik> both
<old_relik> k,v pair
<havenwood> old_relik: So for the shallow version? first.to_a.intersection(second.to_a).to_h
<havenwood> &>> {"a"=>4, "b"=>1, "c"=>3, "g"=>201, "h"=>501}.to_a.intersection({"d"=>19, "e"=>18, "c"=>17, "g"=>201, "h"=>501}.to_a).to_h
<havenwood> #=> {"g"=>201, "h"=>501}
<old_relik> oh right
<old_relik> you could just turn them into tuples and use Array#intersection
<old_relik> hmm
<old_relik> interesting
<havenwood> old_relik: Yeah, that'll account for the pair intersecting.
ur5us has joined #ruby
hiroaki has joined #ruby
<havenwood> old_relik: Again, shallow: [first, second, third].reduce { |acc, hash| acc.to_a.intersection(hash.to_a) }.to_h
<havenwood> old_relik: (If you had more than two.)
<havenwood> old_relik: You can use standard recursion if you'd like to extend it to a deep version.
<old_relik> my depth is fixed
<old_relik> for now
<old_relik> it's just 3 levels
<havenwood> old_relik: Do you know the keys it's under?
<old_relik> yeah
<old_relik> in advance
<old_relik> one sec, I'll post the tree
<havenwood> old_relik: I'm jumping in to a meeting, but I'm sure we can give explicit code that's nice with the tree you provide.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
BTRE has joined #ruby
old_relik has quit [Remote host closed the connection]
old_relik has joined #ruby
<old_relik> got dc'd
<old_relik> havenwood, I know you went to a meeting, but: https://dpaste.org/1Gyb
chalkmonster has quit [Quit: WeeChat 2.9]
<old_relik> I guess one "trouble" with deep is that
<old_relik> you prolly don't want to traverse any further if your upper-level intersected out of the set
<old_relik> wait
<old_relik> that totally did not work
<old_relik> but something like this might suffice
<old_relik> only keys tho
rapidwave has quit [Read error: Connection reset by peer]
rapidwave has joined #ruby
rapidwave has quit [Changing host]
rapidwave has joined #ruby
SeepingN has joined #ruby
dualfade has quit [Ping timeout: 258 seconds]
dualfade has joined #ruby
elphe has joined #ruby
BrianWGray has quit [Quit: Give a man a phish, you might get his credentials. Teach a man to phish, he'll get someone elses.]
TCZ has quit [Quit: Leaving]
<old_relik> nvm
<old_relik> i think my problem can be solved with a deep_merge as a block form
orbyt_ has joined #ruby
dasher00 has quit [Ping timeout: 258 seconds]
banisterfiend has joined #ruby
imode has joined #ruby
Caius has quit [Ping timeout: 272 seconds]
Caius has joined #ruby
Caius has joined #ruby
Caius has quit [Changing host]
<old_relik> nvm again, it can't be
<old_relik> also diff is not the right thing
MadLamb has quit [Ping timeout: 260 seconds]
roshanavand has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ctOS has joined #ruby
SeepingN has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
rafadc_ has joined #ruby
<havenwood> old_relik: Out of meeting, but unsure what you're wanting exactly. Say what the result should be here? https://gist.github.com/havenwood/5cccabd473b7cb6a6e903bca217b0960
<havenwood> old_relik: Would the return value be?: #=> {d: [42]}
<havenwood> old_relik: Or?: #=> {}
<havenwood> old_relik: Or what?
akem has joined #ruby
<havenwood> old_relik: Or?: #=> {b: {d: [42]}}
<havenwood> old_relik: (Which is odd, since `:b` isn't the same value for both.)
RamsesIV has quit [Remote host closed the connection]
rafadc has quit [Quit: ZNC - https://znc.in]
<havenwood> old_relik: If you can give a few "what you have" and "what you want" examples of input and output, I'm sure we can assist in a solution.
<havenwood> old_relik: Ah, just saw your https://dpaste.org/1Gyb#L10 paste. What's the desired result there?
<havenwood> old_relik: Show us the return value you're looking for, like fill in the `i_want.rb` part of this gist. https://gist.github.com/havenwood/a227b63b94e8f9d41de5a18e5f9447ea
ua has quit [Excess Flood]
Mia has quit [Read error: Connection reset by peer]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ua has joined #ruby
weaksauce has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has joined #ruby
hiroaki has quit [Ping timeout: 264 seconds]
jbeaudoin has joined #ruby
braincrash has joined #ruby
braincra- has quit [Ping timeout: 265 seconds]
adu has quit [Quit: adu]
bvdw has quit [Quit: The Lounge - https://thelounge.chat]
bvdw has joined #ruby
alexherbo2 has quit [Ping timeout: 258 seconds]
SeepingN has joined #ruby
old_relik has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
chalkmonster has joined #ruby
SeepingN has quit [Ping timeout: 240 seconds]
crowley has quit [Quit: Leaving]
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #ruby
TCZ has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
TCZ has quit [Quit: Leaving]
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
chalkmonster has quit [Ping timeout: 246 seconds]
dasher00 has joined #ruby
mangoicedtea has joined #ruby
alexherbo2 has quit [Ping timeout: 258 seconds]
TCZ has joined #ruby
SeepingN has joined #ruby
bvdw6 has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw6 is now known as bvdw
alexherbo2 has joined #ruby
alexherbo2 has quit [Ping timeout: 264 seconds]