havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.7.0-preview1: 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!
chalkmonster has joined #ruby
mitt3ns has quit [Quit: brb]
skryking has joined #ruby
kaiser has joined #ruby
skryking_ has quit [Ping timeout: 248 seconds]
kaiser has quit [Remote host closed the connection]
queip has quit [Ping timeout: 245 seconds]
wildtrees has quit [Quit: Leaving]
poontangmessiah has quit [Read error: Connection reset by peer]
poontangmessiah has joined #ruby
queip has joined #ruby
kyrylo has quit [Ping timeout: 245 seconds]
kyrylo has joined #ruby
pep7 has joined #ruby
pep7 has quit [Remote host closed the connection]
cd has joined #ruby
tpanarch1st has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
tpanarch1st has quit [Read error: Connection reset by peer]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TomyLobo has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
kyrylo has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
kyrylo has quit [Ping timeout: 272 seconds]
impermanence has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
[rg] has joined #ruby
chunkypuffs has quit [Quit: ZNC 1.7.1 - https://znc.in]
<[rg]> what are gems?
cd has quit [Quit: cd]
AJA4350 has joined #ruby
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
mre- has joined #ruby
cd has joined #ruby
bitwinery has joined #ruby
mistergibson has joined #ruby
<havenwood> [rg]: packages of Ruby code that we publish and share
<havenwood> [rg]: if you have some code and want to share it with the world, you can "cut a gem" and distribute it so other can `gem install gem-name-here`.
<[rg]> is this central to ruby spec or just happens to be part of community development
<[rg]> like java jars
<[rg]> it's always mentioned but without context when I look at docs for ruby
<havenwood> [rg]: Ruby didn't have Gems at one time but now RubyGems ships with Ruby and is officially maintained.
<[rg]> thanks havenwood
<[rg]> havenwood: do you look at the ruby implemtation?
<havenwood> [rg]: yeah, have ruby implementation questions?
<[rg]> not yet, but I wonder, what is the code base like?
<[rg]> I will be more interested in ruby is hackable for newbies like me :)
<havenwood> [rg]: Ruby core is mostly C code but the standard library is mostly Ruby. Implementations like TruffleRuby are mainly Ruby.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chunkypuffs has joined #ruby
<[rg]> give me the details, is the code base obtuse, slim, what standard does it conform to? :P
dinfuehr has quit [Ping timeout: 272 seconds]
poontangmessiah has quit [Remote host closed the connection]
dinfuehr has joined #ruby
<havenwood> [rg]: It's C. Fairly hard to grok. I'd suggest hacking on TruffleRuby, which is lovely.
<[rg]> ok, much thanks havenwood
ElFerna has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
AJA4350 has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
impermanence has quit [Remote host closed the connection]
[rg] has quit [Quit: [rg]]
fphilipe_ has quit [Ping timeout: 276 seconds]
dionysus69 has quit [Ping timeout: 258 seconds]
mre- has quit [Ping timeout: 245 seconds]
ElFerna has quit [Ping timeout: 258 seconds]
akem-hp has quit [Remote host closed the connection]
akem-hp has joined #ruby
jenrzzz has joined #ruby
kyrylo has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
kyrylo has quit [Client Quit]
brool has quit [Ping timeout: 252 seconds]
ellcs has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
amateur_rubyist has quit [Ping timeout: 272 seconds]
nowhere_man has quit [Ping timeout: 276 seconds]
sylario has quit [Quit: Connection closed for inactivity]
hutch has joined #ruby
DaRock has joined #ruby
fkg has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
chunkypuffs has quit [Quit: ZNC 1.7.1 - https://znc.in]
jenrzzz has quit [Ping timeout: 245 seconds]
fkg has joined #ruby
jenrzzz has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
hutch has quit [Ping timeout: 268 seconds]
mozzarella has quit [Read error: Connection reset by peer]
mozzarella has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
ellcs has joined #ruby
cd has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 245 seconds]
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 245 seconds]
ellcs has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
orbyt_ has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
podlech has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
MrCrackPotBob has quit [Quit: Something went wrong again oh the joys]
ellcs has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
podlech has quit [Quit: WeeChat 2.5-dev]
podlech has joined #ruby
emptyflask has quit [Ping timeout: 268 seconds]
kyrylo has joined #ruby
jenrzzz has joined #ruby
Technodrome has joined #ruby
MrCrackPot has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
dviola has quit [Quit: WeeChat 2.5]
jottr has joined #ruby
jottr has quit [Ping timeout: 268 seconds]
ravenous_ has joined #ruby
ravenous_ has quit [Client Quit]
amateur_rubyist has joined #ruby
sameerynho has joined #ruby
amateur_rubyist has quit [Ping timeout: 248 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
t3hyoshi has quit [Ping timeout: 244 seconds]
Seich has quit [Read error: Connection reset by peer]
t3hyoshi has joined #ruby
Seich_ has joined #ruby
Seich_ is now known as Seich
jenrzzz has joined #ruby
reber has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
jenrzzz has joined #ruby
suukim has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
ravenous_ has joined #ruby
MrCrackPot has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 245 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
podlech has quit [Quit: WeeChat 2.5-dev]
orangejuice has joined #ruby
orangejuice has quit [Client Quit]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
cadeskywalker has joined #ruby
cadeskywalker has quit [Client Quit]
cadeskywalker has joined #ruby
schneider has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
jottr has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
code_zombie has quit [Quit: Leaving]
bitwinery has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
funnel has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
funnel has joined #ruby
jenrzzz has joined #ruby
Fridtjof has quit [Ping timeout: 250 seconds]
jenrzzz has quit [Ping timeout: 244 seconds]
BH23 has joined #ruby
sameerynho has quit [Ping timeout: 258 seconds]
vondruch has joined #ruby
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
amateur_rubyist has joined #ruby
vondruch has quit [Ping timeout: 245 seconds]
vondruch has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
chalkmonster has joined #ruby
BH23 has quit [Ping timeout: 244 seconds]
jottr has quit [Ping timeout: 258 seconds]
fphilipe_ has joined #ruby
Inline__ has joined #ruby
Inline__ has quit [Read error: Connection reset by peer]
Inline has quit [Ping timeout: 264 seconds]
jottr has joined #ruby
fphilipe_ has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
hiroaki has joined #ruby
AJA4350 has joined #ruby
Fr4n has quit [Ping timeout: 245 seconds]
amateur_rubyist has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
ellcs has quit [Ping timeout: 245 seconds]
queip has quit [Ping timeout: 245 seconds]
jottr has quit [Ping timeout: 248 seconds]
queip has joined #ruby
zapata has quit [Quit: WeeChat 2.5]
Fernando-Basso has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
fphilipe_ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
queip has quit [Ping timeout: 272 seconds]
jottr has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
queip has joined #ruby
jottr has quit [Ping timeout: 248 seconds]
Swyper has joined #ruby
gix has joined #ruby
schneider has joined #ruby
ElFerna has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
ElFerna has quit [Quit: ElFerna]
hiroaki has quit [Ping timeout: 252 seconds]
amateur_rubyist has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
queip has quit [Ping timeout: 245 seconds]
lucasb has joined #ruby
queip has joined #ruby
davor has quit [Ping timeout: 276 seconds]
davor has joined #ruby
ElFerna has joined #ruby
tpanarch1st has joined #ruby
ElFerna has quit [Ping timeout: 248 seconds]
Swyper has quit [Remote host closed the connection]
emptyflask has joined #ruby
involans has joined #ruby
greengriminal has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
Swyper has joined #ruby
sleepee has joined #ruby
AJA4350 has joined #ruby
sylario has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
ElFerna has joined #ruby
ElFerna has quit [Read error: Connection reset by peer]
ElFerna has joined #ruby
ElFerna has quit [Ping timeout: 245 seconds]
sgen has joined #ruby
ElFerna has joined #ruby
ElFerna has quit [Read error: Connection reset by peer]
ElFerna has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
ElFerna has quit [Ping timeout: 244 seconds]
chalkmonster has joined #ruby
sgen has quit [Ping timeout: 276 seconds]
amateur_rubyist has joined #ruby
Swyper has joined #ruby
yann-kaelig has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
Inline has joined #ruby
sleepee has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
hutch has joined #ruby
jottr has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
manj-gnome_ has joined #ruby
manj-gnome_ has quit [Remote host closed the connection]
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sleepee has joined #ruby
queip has quit [Ping timeout: 244 seconds]
Fernando-Basso has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
queip has joined #ruby
hutch has joined #ruby
DaRock has quit [Ping timeout: 258 seconds]
Fridtjof has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
redlegion has quit [Quit: The Lounge - https://thelounge.chat]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
redlegion has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
amateur_rubyist has quit [Remote host closed the connection]
sleepee has quit [Ping timeout: 272 seconds]
amateur_rubyist has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
jottr has joined #ruby
queip has quit [Ping timeout: 246 seconds]
jottr has quit [Ping timeout: 268 seconds]
brool has joined #ruby
poontangmessiah has joined #ruby
queip has joined #ruby
rippa has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
dinfuehr has quit [Ping timeout: 272 seconds]
dinfuehr has joined #ruby
banisterfiend has joined #ruby
hrhsh has joined #ruby
hrhsh has quit [Client Quit]
ellcs has joined #ruby
hrhsh has joined #ruby
hutch has quit [Quit: WeeChat 2.5]
hrhsh has quit [Client Quit]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grilix has joined #ruby
banisterfiend has quit [Ping timeout: 245 seconds]
igolden has joined #ruby
poontangmessiah has quit [Remote host closed the connection]
igolden has quit [Quit: leaving]
amateur_rubyist has quit [Remote host closed the connection]
queip has quit [Ping timeout: 272 seconds]
suukim has quit [Quit: Konversation terminated!]
jenrzzz has joined #ruby
queip has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
morozovm has joined #ruby
star_prone has joined #ruby
<star_prone> Hi!
Freshnuts has joined #ruby
<star_prone> I started learning Ruby and found as a resource http://rubykoans.com/. downloaded the Koans, installed ruby on Ubuntu 18.04 with snap, opened the files in RubyMine and tried to configure Ruby interpreter, but I get the error "Error configuring SDK: Could not get RubyGems environment for ruby-2.6.3-p62: ver.2.6.3p0 (/snap/bin/ruby)."
<star_prone> any ideas?
deepredsky has joined #ruby
deepreds1 has quit [Ping timeout: 248 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
drnerdius has joined #ruby
Nicmavr has joined #ruby
banisterfiend has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
poontangmessiah has joined #ruby
<havenwood> star_prone: Same if you?: eval "$(ruby.env)"
<havenwood> star_prone: I've not used the snap package for Ruby development. Hmm.
<havenwood> star_prone: You might want to consider installing the Brightbox ruby-dev package for Ubuntu or the Fullstaq one.
ellcs has quit [Ping timeout: 264 seconds]
<havenwood> star_prone: Of if you want to build any version of Ruby yourself and switch to it, there are some handy tools that make that easy: https://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
ellcs has joined #ruby
<havenwood> star_prone: It might be fun to get the snap Ruby version working. I think of snaps as more to be available as dependencies, but I've not actually tried using the Ruby snap for Ruby dev so I can't rule out that it's possible.
<star_prone> havenwood: command not found: ruby.env
<star_prone> havenwood: thank you!
<havenwood> star_prone: not actually sure where ruby.env is expected to come from. i presumed it existed since it was referenced here: https://www.ruby-lang.org/en/news/2018/11/08/snap/
<havenwood> I made a snap. I guess a few people have tried it. Heh. https://snapcraft.io/siphash
<havenwood> It's quite easy to distribute a RubyGem as a snap, it turns out.
poontangmessiah has quit [Remote host closed the connection]
justache is now known as justache2
justache2 is now known as justache
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grilix has quit [Ping timeout: 245 seconds]
sameerynho has joined #ruby
cd has joined #ruby
nowhere_man has joined #ruby
dinfuehr has quit [Ping timeout: 244 seconds]
dinfuehr has joined #ruby
troulouliou_dev has joined #ruby
nowhere_man has quit [Ping timeout: 252 seconds]
orbyt_ has joined #ruby
AJA4350 has joined #ruby
Fr4n has joined #ruby
nowz has joined #ruby
deepreds1 has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
deepredsky has quit [Ping timeout: 248 seconds]
ravenous_ has quit [Quit: Textual IRC Client: www.textualapp.com]
ravenous_ has joined #ruby
amateur_rubyist has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
planigan has quit [Ping timeout: 258 seconds]
amateur_rubyist has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
vondruch has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
code_zombie has joined #ruby
amateur_rubyist has quit [Ping timeout: 272 seconds]
duderonomy has joined #ruby
morozovm has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
drnerdius has quit [Quit: Konversation terminated!]
jottr has joined #ruby
planigan has joined #ruby
Fernando-Basso has joined #ruby
jottr has quit [Ping timeout: 248 seconds]
Fernando-Basso has quit [Max SendQ exceeded]
Fernando-Basso has joined #ruby
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
queip has quit [Ping timeout: 248 seconds]
queip has joined #ruby
jottr has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 272 seconds]
morozovm has joined #ruby
dionysus69 has quit [Ping timeout: 258 seconds]
morozovm has quit [Ping timeout: 268 seconds]
troulouliou_div2 has joined #ruby
schneider has quit [Ping timeout: 272 seconds]
d^sh has quit [Ping timeout: 248 seconds]
d^sh has joined #ruby
nowz has quit [Quit: WeeChat 1.6]
ur5us has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
tpanarch1st has quit [Ping timeout: 272 seconds]
tpanarch1st_ has joined #ruby
jottr has joined #ruby
zapata has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
oetjenj has joined #ruby
RyanMcCoskrie has joined #ruby
bitwinery has joined #ruby
Fr4n has quit [Ping timeout: 244 seconds]
Technodrome has joined #ruby
^amra has joined #ruby
<^amra> Hello, guys
<^amra> I need some help with this code: https://pastebin.com/Fd0QU1Ti
<ruby[bot]> ^amra: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<havenwood> #!> NameError: undefined local variable or method `team_red' for main:Object
Technodrome has quit [Remote host closed the connection]
<^amra> I have two sorted by :score key hashes team_red and team_blue, and I try to merge both by :n_1 {:player_7 {}, :player_3 {}}
Inline has quit [Quit: Leaving]
<^amra> At another pastebin service
<leftylink> may I suggest that when one wants to walk two enumerables in lock-step, then Enumerable#zip is a possibility.
<havenwood> #!> NoMethodError: undefined method `team' for main:Object
<havenwood> ^amra: The example still isn't runnable. You'll get more bites. ¯\_(ツ)_/¯
<havenwood> ^amra: Show a runnable example and show the actual return value you want.
<havenwood> ^amra: With those things, folk can easily help.
<havenwood> ^amra: Run the code you're showing and check the result.
<havenwood> ^amra: Broken.
<havenwood> ^amra: Run it!
<^amra> damned.
<^amra> ok
<havenwood> ^amra: Paste that into IRB.
<havenwood> ^amra: Hint: `team red` != `team_red`.
<havenwood> ^amra: You don't need to pre-declare: teams_red = {}
<havenwood> ^amra: Check your variable names closely, but more importantly run it!
<havenwood> Running code surfaces issues.
<havenwood> ?irb ^amra
<ruby[bot]> ^amra: irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
<havenwood> ?pry ^amra
<ruby[bot]> ^amra: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<havenwood> #!> NameError: undefined local variable or method `team_blue' for main:Object
<havenwood> ^amra: Close!
<havenwood> ^amra: But not quite.
<havenwood> I think you're a 1 away.
<havenwood> ^amra: Paste it in irb?
<havenwood> ^amra: From the command line, type: irb
<havenwood> ^amra: Then paste!
<^amra> This code is runnable
<^amra> havenwood, yes I ran the irb and paste the code
<^amra> it's runnable now
<havenwood> ^amra: #!> SyntaxError: unexpected '\n', expecting =>
<^amra> ???
<havenwood> ^amra: It runs!
<^amra> I got worked result in irb
<havenwood> ^amra: Nice
<^amra> But with wrong sorting pairs
<havenwood> ^amra: The best thing would be showing the desired result, but that might be hard here. Can you describe what's wrong in more detail?
<^amra> Where you have this error? #!> SyntaxError: unexpected '\n', expecting =>
<havenwood> ^amra: The latest code raw worked. :)
<havenwood> ^amra: All good!
<havenwood> ^amra: Now it's just what's wrong with the result.
<^amra> In first key of hash named :n_7 must be two hashes but there is only one
<^amra> And this heshes must be player_7 and player_3
<^amra> bu there is only player_7 hash in n_7
<^amra> And I don't understand why it's named :n_7 and no :n_1
<havenwood> ^amra: For :n_7 you can: :"n_#{n}"
<havenwood> ^amra: (it's currently :n7)
<leftylink> well of course it's n7. think about what what `k[/\d+\z/]` result in for `:player_7`
<leftylink> there's nothing else it could possibly be
queip has quit [Ping timeout: 258 seconds]
<^amra> oh, sorry, the "_" is not important
<^amra> I mean :n1 and not :n7 as first key in hash
<havenwood> ^amra: :n1 is another key
<havenwood> ^amra: it's there
<havenwood> ^amra: what's wrong about it?
<havenwood> ^amra: These aren't sorted, to be clear. Is the issue that you want them to be sorted?
<havenwood> ^amra: Showing the desired result would help us be able to glean the purpose without you saying.
<havenwood> ^amra: In the absence of the desired result, you'll need to spell it out.
<^amra> I want to get two sorted hashes :team_red and :team_blue and merge them one by one to :n1 {:player_7 {}, player_3 {}}, n2: {:player_8 {}, :player_4 {}}
<havenwood> ^amra: Is the sort order wrong? What's wrong?
<^amra> But I got :n7 {:player_7 {}}, n8: {:player_8 {}}
<havenwood> ^amra: Show the desired result?
<havenwood> What should it be?
<^amra> {:n1 {:player_7 {}, player_3 {}}, n2: {:player_8 {}, :player_4 {}}}
<^amra> this is the correct result
<leftylink> 21:44:11 < leftylink> may I suggest that when one wants to walk two enumerables in lock-step, then Enumerable#zip is a possibility.
<^amra> and :n3 :n4 etc
<havenwood> ^amra: Ah, so the n1 doesn't refer to the player number but the sort order?
<havenwood> ^amra: That means the code is wrong.
<^amra> yes
<^amra> and into :n1 I want to put two inserts first from team_red1 as key: value, and second from team_blue1 as ke: value
banisterfiend has joined #ruby
wickedbloodfart has joined #ruby
wickedbloodfart has quit [Client Quit]
queip has joined #ruby
<^amra> to :n2 I want to put two inserts: FIRST is the second pair key: value from team_red1, and SECOND is the second pair key: value from team_blue1
<havenwood> ^amra: [team_red, team_blue1].reduce(:merge).group_by { |score:, **| score }.to_h { |k, v| [:"n_#{k}", v.to_h] }
<havenwood> ^amra: Don't set: team_red = {}
<havenwood> ^amra: Unnecessary.
<^amra> ko
ellcs has quit [Ping timeout: 246 seconds]
<^amra> This code is not working(
<havenwood> ^amra: That works with additional hashes if you want to: hashes.reduce(:merge).group_by { |score:, **| score }.to_h { |k, v| [:"n_#{k}", v.to_h] }
<havenwood> It works in my head. Prove it!
<^amra> It's put into new one hash the key value pair from team_red sorted by score and then from team_blue
<^amra> Where is :"n_#{n}" includes only one key value pair, but it must be two pairs
<^amra> In :"n_#{n}" must be two hashes
<^amra> And there is only one hash in each #n_N
<^amra> :n_N
<havenwood> ^amra: Say more about what's wrong with this?: https://gist.github.com/havenwood/434b0eab8573e6cd3bd61bf434620381
<havenwood> ^amra: Is :n_27 as expected?
<havenwood> ^amra: If not, what's expected?
<^amra> In :n_27 is only one hash :player_7, but it must be two hashes - :player_7 and :player_3
<havenwood> 3 is n_29
<^amra> And :n_27 must be named as :n_1 in ideal case
<havenwood> ^amra: You want pairs?
<^amra> Yes ofcourse
<havenwood> ^amra: Of course?
<havenwood> Lol
<^amra> I need the pairs
<havenwood> FFS
<^amra> :))
<havenwood> I have no clue what you're doing. I'm trying to glean clues. You never mentioned pairs of winners.
<havenwood> ¯\_(ツ)_/¯
<^amra> Sorry :)
<^amra> Apparently I didn’t explain it well.
<^amra> Sorry one more time
jottr has joined #ruby
<havenwood> ^amra: [red, blue].reduce(:merge).group_by { |score:, **| score }.map { |k, v| [k, v.to_h] }.sort_by(&:first).reverse.each_slice(2).map.with_index(1) { |a, i| [:"n_#{i}", a.to_h.values] }.to_h
<^amra> one sec pls
<havenwood> ^amra: That's my thinking based on what you've said most recently.
<havenwood> ^amra: Or: [red, blue].reduce(:merge).group_by { |score:, **| score }.map { |k, v| [k, v.to_h] }.sort_by(&:first).reverse.each_slice(2).map.with_index(1) { |a, i| [:"n_#{i}", a.to_h.values.reduce(:merge)] }.to_h
<havenwood> ^amra: Is that the desired result?
<^amra> First is not, sec
<havenwood> ^amra: If you could show the desired result with this data or make a simpler example that encompasses the logic it'd help tremendously.
<^amra> Second not working too
<^amra> Ok
<havenwood> ^amra: Show them and what they should be?
<^amra> one sec
<^amra> pls
<havenwood> ^amra: What's wrong with n_1?
<havenwood> I'm required to solve issues on IRC and this is hurting my quota.
<^amra> :n_1 must be {:n_1 {:player_7=>{:id=>7, :team=>"r", :name=>"Player_7", :score=>27, :ping=>3, :cc=>"RU", :osp=>"osp", :rate=>"50000", :snaps=>"20"}, {:player_3=>{:id=>3, :team=>"b", :name=>"Player_3", :score=>29, :ping=>10, :cc=>"BY", :osp=>"osp", :rate=>"25000", :snaps=>"40"}}
<^amra> It must be from two hashes - first from red and first from blue
<havenwood> ^amra: Ahh, not the top two total. You want a top score from each, paired?
<^amra> yes
<^amra> :n_2 {:player_8=>{:id=>8, :team=>"r", :name=>"Player_8", :score=>24, :ping=>10, :cc=>"RU", :osp=>"osp", :rate=>"15000", :snaps=>"20"}, :player_4=>{:id=>4, :team=>"b", :name=>"Player_4", :score=>24, :ping=>10, :cc=>"RU", :osp=>"osp", :rate=>"15000", :snaps=>"20"}}
<^amra>
<^amra> And this is next :n_2
<^amra> :n_3 {:player_9=>{:id=>9, :team=>"r", :name=>"Player_9", :score=>12, :ping=>29, :cc=>"LV", :osp=>"osp", :rate=>"15000", :snaps=>"20"}, :player_0=>{:id=>0, :team=>"b", :name=>"Player_0", :score=>24, :ping=>21, :cc=>"RU", :osp=>"osp", :rate=>"50000", :snaps=>"40"}
<^amra> etc
AJA4350 has quit [Ping timeout: 244 seconds]
<havenwood> leftylink was right
jenrzzz has joined #ruby
<^amra> :))
<havenwood> ^amra: [red, blue].map { |color| color.group_by { |score:, **| score } }.reduce(:zip).map.with_index(1) { |pair, i| [:"n_#{i}", pair.map(&:last).map(&:last).to_h] }.to_h
<havenwood> ^amra: Is *that* the desired result? >.>
<^amra> sec)
<havenwood> ^amra: I think there's a bug in there, since you need highest of the two scores.
<havenwood> ^amra: But I think it works with your single example case.
<^amra> hm
<^amra> nearly to ideal
<havenwood> ^amra: You can see, I sorted before zipping. For the correct result, you'll want to sort after zipping.
jenrzzz has quit [Ping timeout: 244 seconds]
<havenwood> Actually, did I even sort?
<havenwood> Haha
<havenwood> No.
<^amra> ec
<^amra> sec
<havenwood> But yeah, sort after zipping.
<^amra> This is current result
<havenwood> I finally understand what you want.
<^amra> :n_1 is ideal
<^amra> But :n_2 ... have an error
<havenwood> I'm bored of this, but since I understand your ask now I guess I'll implement. Unless someone else wants to?
<^amra> It must be 8 and 4, but it's 8 and 0
<ec> yes?
<leftylink> my immediate and visceral reaction to "unless someone else wants to" was "F*** NO" but I had to debate on whether to actually type that in channel. as you can see, the result of the debate was to type it.
reber has quit [Remote host closed the connection]
<^amra> :))
<^amra> The solution is very close :)
<leftylink> :)
RyanMcCoskrie has quit [Read error: Connection reset by peer]
amateur_rubyist has joined #ruby
<^amra> Some key pairs is dissapear from result
<havenwood> ^amra: [red, blue].map { |color| color.sort_by { |score:, **| -score } }.reduce(:zip).map.with_index(1) { |a, i| [:"n_#{i}", a.to_h] }.to_h
bitwinery has quit [Remote host closed the connection]
<havenwood> ^amra: I *think* I understand what you want. Check the code!
bitwinery has joined #ruby
<^amra> sec)
<^amra> YES!
<^amra> Like a charm!
<^amra> Oh my god.
<^amra> Thank you very much :))
<havenwood> You're welcome
<^amra> And sorry for incorrectly explaining
jottr has quit [Ping timeout: 245 seconds]
<havenwood> ^amra: No worries. You'll find the UNIX rule holds true that data is easier to understand than logic. If you can provide working code with desired data input and output it'll often shortcut a solution.
<^amra> You right
<^amra> Thanks :)
ur5us has quit [Read error: Connection reset by peer]
<havenwood> No prob :)
ur5us has joined #ruby
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
phroa has quit [Ping timeout: 272 seconds]
sameerynho has quit [Ping timeout: 272 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
Fernando-Basso has quit [Remote host closed the connection]
poontangmessiah has joined #ruby
jenrzzz has joined #ruby
Mrgoose84 has quit [Quit: The Lounge - https://thelounge.chat]
Mrgoose84 has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
ur5us_ has quit [Read error: Connection reset by peer]
ElFerna has joined #ruby
morozovm has joined #ruby
ElFerna has quit [Client Quit]
morozovm has quit [Ping timeout: 258 seconds]
<leftylink> &>> p
<rubydoc> stderr: /home/carcin/carcin/sandboxes/ruby/sandboxed_ruby2.6.0: error while loading shared libraries:... check link for more (https://carc.in/#/r/7g96)
gix has quit [Ping timeout: 245 seconds]
AJA4350 has joined #ruby
<leftylink> did anyone ever make a joke about ogen
<leftylink> nope, no such joke in my logs