havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 2.5.3, 2.4.5: 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!
blackmesa1 has quit [Ping timeout: 268 seconds]
jyaworski has quit [Ping timeout: 240 seconds]
jyaworski has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
znz_jp has quit [Ping timeout: 264 seconds]
jyaworski has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
canton7 has quit [Quit: ZNC - http://znc.in]
canton7 has joined #ruby
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
gix has quit [Ping timeout: 255 seconds]
bmurt has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
cthulchu has quit [Ping timeout: 245 seconds]
TiglatePileser has joined #ruby
Fusl has quit [Remote host closed the connection]
Fusl has joined #ruby
faitswulff has quit [Remote host closed the connection]
TiglatePileser has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 245 seconds]
faitswulff has joined #ruby
AJA4350 has quit [Ping timeout: 255 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
blackmesa1 has joined #ruby
dviola has quit [Quit: WeeChat 2.4]
Dbugger has quit [Ping timeout: 264 seconds]
blackmesa1 has quit [Ping timeout: 244 seconds]
ramfjord has quit [Ping timeout: 255 seconds]
ramfjord has joined #ruby
blackmesa1 has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
lucasb has quit [Quit: Connection closed for inactivity]
AJA4350 has joined #ruby
ansraliant has joined #ruby
crankhar1er has quit [Ping timeout: 255 seconds]
orbyt_ has quit [Ping timeout: 245 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
mangold has joined #ruby
ramfjord has quit [Read error: Connection reset by peer]
Fernando-Basso has quit [Remote host closed the connection]
AJA4350 has quit [Quit: AJA4350]
Fusl has quit [Remote host closed the connection]
Fusl has joined #ruby
crankharder has joined #ruby
Swyper has joined #ruby
<Swyper> hi
<havenwood> Swyper: hi
jyaworski has joined #ruby
<Swyper> I'm trying to access an array of hash values
<Swyper> using a key, age
<Swyper> my approach is bad, I should be comparing the value
jyaworski has quit [Ping timeout: 255 seconds]
<havenwood> Swyper: Yes, do compare the value. That aside, `:age` and `"age"` aren't the same key.
<havenwood> Swyper: When iterating from a collection and naming the block argument, consider always using the singular form of the collection.
<havenwood> Swyper: So: people.each do |person|
<Swyper> 02_adult_in_group.rb:9:in `>=': comparison of String with 18 failed (ArgumentError)
<Swyper> i see
<Swyper> ^ new error, updated code
<havenwood> Swyper: (It's not an Array, so `arr` is a bit confusing!)
<Swyper> fair
<Swyper> also I fixed my error
<Swyper> if(!(value.kind_of?(String)))
<Swyper> ^ fixes it
<havenwood> Swyper: It'd be nicer to just check the ages, instead of all values.
<Swyper> I agree
<havenwood> Swyper: person[:age]
<havenwood> Swyper: This is a good case for Enumerable#any? too :)
<Swyper> thank you havenwood
<havenwood> Swyper: You're doing an extra iteration in there.
<havenwood> Swyper: Try just: people.each do |person| ... (without a second #each)
<havenwood> There's no need for |key, value| as you've rewritten iit.
renich has quit [Quit: renich]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #ruby
<havenwood> Swyper: Then you might consider: people.any? do |person|
<havenwood> Swyper: Then you can omit the if statement and the `return true` and `return false`.
renich has joined #ruby
renich has quit [Quit: renich]
yokel has quit [Ping timeout: 240 seconds]
<Swyper> output is incorrect atm, false, true, false false
<Swyper> its supposed to true, true, false, false
<Swyper> tho I don't see why
<leftylink> at first was like "WHAT, didn't you already do this in december", but that was the `ordered_vowel_word?` question, phew
<leftylink> if it had been the exact question it would have been very dismaying.
<leftylink> s/exact/exact same/
<leftylink> Swyper: please consider the value of intermediate expressions. for example, use a REPL to see what the value of "aaoeee".split is
<havenwood> Swyper: I think you mean #chars but you have #split.
<havenwood> &>> "aaoeee".split
<rubydoc> # => ["aaoeee"] (https://carc.in/#/r/6e01)
<havenwood> &>> "aaoeee".chars
<rubydoc> # => ["a", "a", "o", "e", "e", "e"] (https://carc.in/#/r/6e02)
<havenwood> I agree with the suggestion to use a REPL!
<havenwood> ?irb
<ruby[bot]> 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
<ruby[bot]> 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
<Swyper> leftylink: I don't see the problem if it was the exact same question, I haven't touched Ruby in a long time so I'm going through some altered versions of the same questions
<Swyper> but yeah I should use pry, thanks
orbyt_ has joined #ruby
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #ruby
tdy has quit [Ping timeout: 255 seconds]
tdy has joined #ruby
faitswulff has quit [Ping timeout: 250 seconds]
tdy1 has joined #ruby
donofrio has joined #ruby
tdy1 has quit [Read error: Connection reset by peer]
tdy1 has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
tdy1 has quit [Read error: Connection reset by peer]
tdy1 has joined #ruby
donofrio has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
tdy2 has joined #ruby
jyaworski has joined #ruby
tdy1 has quit [Ping timeout: 250 seconds]
jyaworski has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy2 has quit [Ping timeout: 250 seconds]
tdy3 has joined #ruby
Swyper has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
mangold has joined #ruby
tdy3 has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 258 seconds]
donofrio has joined #ruby
blackmesa has quit [Ping timeout: 258 seconds]
jyaworski has joined #ruby
crankharder has quit [Ping timeout: 250 seconds]
wolfshappen_ has quit [Ping timeout: 240 seconds]
donofrio has quit [Remote host closed the connection]
jyaworski has quit [Ping timeout: 246 seconds]
wolfshappen has joined #ruby
jyaworski has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
jyaworski has quit [Ping timeout: 246 seconds]
Fusl has quit [Remote host closed the connection]
Fusl has joined #ruby
conta has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fusl has quit [Ping timeout: 256 seconds]
kapil____ has joined #ruby
Fusl has joined #ruby
faitswulff has joined #ruby
faitswulff has quit [Ping timeout: 264 seconds]
Swyper has quit [Remote host closed the connection]
crankharder has joined #ruby
dellavg__ has joined #ruby
conta has quit [Quit: conta]
t0xik has joined #ruby
crankharder has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
SeepingN has quit [Ping timeout: 255 seconds]
tdy1 has joined #ruby
rippa has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
tdy2 has joined #ruby
tdy2 has quit [Read error: Connection reset by peer]
tdy1 has quit [Ping timeout: 250 seconds]
tdy2 has joined #ruby
hiroaki_ has quit [Ping timeout: 250 seconds]
jyaworski has joined #ruby
jordanm has quit [Ping timeout: 250 seconds]
nwradio has quit [Read error: Connection reset by peer]
nwradio has joined #ruby
jyaworski has quit [Ping timeout: 246 seconds]
jordanm has joined #ruby
sauvin has joined #ruby
nwradio has quit [Quit: Ping timeout (120 seconds)]
nwradio has joined #ruby
agent_white has quit [Quit: latert]
jordanm has quit [Ping timeout: 268 seconds]
iMadper is now known as iMadper|MSGA
jordanm has joined #ruby
reber has joined #ruby
tdy3 has joined #ruby
tdy2 has quit [Ping timeout: 245 seconds]
tdy4 has joined #ruby
tdy has joined #ruby
tdy3 has quit [Ping timeout: 245 seconds]
tdy4 has quit [Ping timeout: 245 seconds]
tdy1 has joined #ruby
dellavg__ has quit [Ping timeout: 245 seconds]
tdy has quit [Ping timeout: 246 seconds]
iMadper|MSGA is now known as iMadper|Qiong
maufart__ has joined #ruby
ogres has quit [Quit: Connection closed for inactivity]
faitswulff has joined #ruby
ogres has joined #ruby
faitswulff has quit [Ping timeout: 250 seconds]
t0xik is now known as t0x
n13z has quit [Ping timeout: 246 seconds]
jyaworski has joined #ruby
reber has quit [Remote host closed the connection]
jyaworski has quit [Ping timeout: 250 seconds]
n13z has joined #ruby
aupadhye has joined #ruby
tdy1 has quit [Ping timeout: 240 seconds]
prestorium has joined #ruby
_whitelogger has joined #ruby
dionysus69 has joined #ruby
jyaworski has quit [Ping timeout: 244 seconds]
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
aupadhye has quit [Remote host closed the connection]
bruce_lee has joined #ruby
renich has joined #ruby
aupadhye has joined #ruby
blackmesa has joined #ruby
aupadhye has quit [Remote host closed the connection]
akem has quit [Remote host closed the connection]
akem has joined #ruby
ansraliant has quit [Quit: My planet needs me]
aupadhye has joined #ruby
renich has quit [Quit: renich]
faitswulff has joined #ruby
luminous has quit []
faitswulff has quit [Ping timeout: 264 seconds]
olspookishmagus has joined #ruby
ogres has quit [Quit: Connection closed for inactivity]
lxsameer has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
al2o3-cr has quit [Quit: WeeChat 2.4]
adgtl- has quit [Ping timeout: 258 seconds]
cd has quit [Quit: cd]
adgtl has joined #ruby
al2o3-cr has joined #ruby
lunarkitty has quit [Ping timeout: 250 seconds]
adgtl has quit [Ping timeout: 255 seconds]
prestorium has quit [Quit: prestorium]
vondruch has joined #ruby
vondruch has quit [Client Quit]
tdy1 has quit [Ping timeout: 255 seconds]
apparition has joined #ruby
wolfshappen has quit [Ping timeout: 244 seconds]
adgtl has joined #ruby
crankharder has joined #ruby
lunarkitty has joined #ruby
wolfshappen has joined #ruby
Mike11 has joined #ruby
johnny56 has joined #ruby
postmodern has quit [Quit: Leaving]
chrisco has joined #ruby
cisco has joined #ruby
wildermind has joined #ruby
marmotini_ has joined #ruby
ropeney has quit [Ping timeout: 250 seconds]
chrisco has quit [Remote host closed the connection]
dellavg__ has joined #ruby
ropeney has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
am0123 has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.4]
faitswulff has joined #ruby
al2o3-cr has joined #ruby
Tuor has joined #ruby
faitswulff has quit [Ping timeout: 268 seconds]
beefjoe has joined #ruby
conta has joined #ruby
jyaworski has joined #ruby
conta has quit [Ping timeout: 250 seconds]
jyaworski has quit [Ping timeout: 255 seconds]
am0123 has quit [Ping timeout: 255 seconds]
arekushi has quit [Ping timeout: 250 seconds]
deathwishdave has joined #ruby
AJA4350 has joined #ruby
am0123 has joined #ruby
am0123 has quit [Ping timeout: 240 seconds]
Snowy has joined #ruby
conta has joined #ruby
jyaworski has joined #ruby
maufart__ has quit [Remote host closed the connection]
conta has quit [Ping timeout: 240 seconds]
jyaworski has quit [Ping timeout: 268 seconds]
camilasan has quit [Ping timeout: 250 seconds]
tjbp has quit [Remote host closed the connection]
tjbp has joined #ruby
jyaworski has joined #ruby
ldnunes has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.4]
Xiti has quit [Quit: Xiti]
blaguvest has joined #ruby
jyaworski has quit [Ping timeout: 246 seconds]
al2o3-cr has joined #ruby
camilasan has joined #ruby
queip has joined #ruby
Mike11 has quit [Quit: Leaving.]
Xiti has joined #ruby
themsay has joined #ruby
faitswulff has joined #ruby
grr12314 has joined #ruby
<grr12314> wtf ruby, string.sum is giving me a different result from string.bytes.sum
<grr12314> for a long string
<grr12314> the difference is 65536...
<grr12314> damn someone used 16bit int wtf
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
xrexeon has joined #ruby
stryek has joined #ruby
beefjoe has quit [Quit: <3]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
lucasb has joined #ruby
Snowy has quit [Remote host closed the connection]
Snowy has joined #ruby
am0123 has joined #ruby
tjbp has quit [Quit: No Ping reply in 180 seconds.]
tjbp has joined #ruby
Snowy has quit [Ping timeout: 255 seconds]
gnufied has quit [Ping timeout: 246 seconds]
am0123 has quit [Ping timeout: 255 seconds]
beefjoe has joined #ruby
<grr12314> this chan isn't too popular is it...
<phaul> You get a fairly quick response if you come in asking for help. If you come in for a rant it depends. Sometimes ppl are not in the mood
FastJack has quit [Ping timeout: 264 seconds]
aupadhye has quit [Ping timeout: 244 seconds]
<grr12314> thats cool. it seems "working as intended" https://www.rubydoc.info/stdlib/core/String:sum
<grr12314> i wonder how many people fall into that trap tho
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hightower2 has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
deathwishdave has joined #ruby
gregf_ has quit [Ping timeout: 256 seconds]
aupadhye has joined #ruby
alem0lars has joined #ruby
gensym has joined #ruby
<gensym> hi, n00b question: i want something like .dig() or safe navigation &. for strings as hashkeys. Both dig() and .& only works for :keys as hashkeys. Any idea?
<gensym> something like h = {'foo'=>'bar'}; and h&.['foo']&.['baz']
<phaul> &>> {'a' => { 'b' => { 'c' => 1 } } }.dig('a', 'b', 'c')
<rubydoc> # => 1 (https://carc.in/#/r/6e1x)
<phaul> gensym: ^
<gensym> @phaul: okay, my problem ist following:
<gensym> &>> {'a' => { 'b' => { 'c' => 1 } } }.dig('a', 'b', 'c', 'd')
<rubydoc> stderr: -e:2:in `dig': Integer does not have #dig method (TypeError) (https://carc.in/#/r/6e1y)
marmotini_ has quit [Remote host closed the connection]
<phaul> dig works under the assumption that the hash either contains right data. the last level there contains 1, which is not right for looking up 'd' in it.
<phaul> s/either//
<phaul> &>> {'a' => { 'b' => { 'c' => {} } } }.dig('a', 'b', 'c', 'd')
<rubydoc> # => nil (https://carc.in/#/r/6e1z)
<phaul> so question there is why the value 1 under 'c' if you expect hash under it (to look up 'd') ?
jyaworski has joined #ruby
Tuor has quit [Quit: Konversation terminated!]
<gensym> maybe i dont know the structure :/
ams__ has joined #ruby
alem0lars has quit [Ping timeout: 255 seconds]
jyaworski has quit [Ping timeout: 244 seconds]
SeepingN has joined #ruby
bmurt has quit [Quit: Textual IRC Client: www.textualapp.com]
salasrod has quit [Remote host closed the connection]
salasrod has joined #ruby
bmurt has joined #ruby
aqd has quit [Quit: Leaving]
alem0lars has joined #ruby
grr12314 has quit [Remote host closed the connection]
kapil____ has joined #ruby
Rapture has joined #ruby
gnufied has joined #ruby
alem0lars has quit [Ping timeout: 255 seconds]
skryking has joined #ruby
polishdub has joined #ruby
gensym has quit []
aupadhye has quit [Ping timeout: 246 seconds]
beefjoe has quit [Quit: <3]
jcalla has joined #ruby
jyaworski has joined #ruby
jcarl43 has joined #ruby
reber has joined #ruby
jcarl43 has quit [Client Quit]
jyaworski has quit [Ping timeout: 255 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
jcarl43 has joined #ruby
jyaworski has joined #ruby
jyaworski has quit [Ping timeout: 255 seconds]
moei has joined #ruby
cisco has quit [Quit: leaving]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
stryek has quit [Quit: Connection closed for inactivity]
jyaworski has joined #ruby
Dbugger has joined #ruby
galaxie has left #ruby [#ruby]
conta1 has joined #ruby
conta1 has quit [Ping timeout: 255 seconds]
Rapture has quit [Ping timeout: 244 seconds]
duderonomy has quit [Ping timeout: 250 seconds]
sylario has joined #ruby
Rapture has joined #ruby
themsay has quit [Ping timeout: 250 seconds]
Rapture has quit [Ping timeout: 244 seconds]
whathappens has joined #ruby
cisco has joined #ruby
apparition has quit [Quit: Bye]
jyaworski has quit [Ping timeout: 258 seconds]
tdy1 has joined #ruby
deathwishdave has quit [Quit: Textual IRC Client: www.textualapp.com]
faitswulff has quit []
orbyt_ has joined #ruby
FastJack has joined #ruby
tdy1 has quit [Ping timeout: 255 seconds]
mniip has quit [Ping timeout: 600 seconds]
gix has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
Snowy has joined #ruby
Snowy has quit [Client Quit]
kitikonti has joined #ruby
gix has quit [Quit: Client exiting]
AJA4350 has quit [Ping timeout: 246 seconds]
gix has joined #ruby
Onwarion has quit [Read error: Connection reset by peer]
jottr has joined #ruby
lunarkitty is now known as linarkitty7
[Butch] has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
linarkitty7 is now known as lunarkitty7
duderonomy has joined #ruby
kitikonti has quit [Quit: Textual IRC Client: www.textualapp.com]
clemens3_ has quit [Remote host closed the connection]
mniip has joined #ruby
whathappens has quit [Remote host closed the connection]
ellcs has quit [Remote host closed the connection]
paraxial7 has quit [Quit: The Lounge - https://thelounge.chat]
Dbugger has quit [Remote host closed the connection]
orbyt_ has quit [Ping timeout: 240 seconds]
amosbird has joined #ruby
<amosbird> Hello, can anyone help me with this https://la.wentropy.com/P1gC?
<amosbird> I have no idea how to read ruby
<amosbird> what directory does this ruby script need?
Dbugger has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
<leftylink> I see that you are asking about a directory. That probably means https://ruby-doc.org/core-2.5.1/Dir.html#method-c-5B-5D is a good starting point for the answer
<amosbird> benchs = `./#{Dir["bench*"].first} l`.split("\n")
<amosbird> what does this mean?
<amosbird> ok, i get it
<amosbird> puts
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Swyper has joined #ruby
FastJack has quit [Ping timeout: 264 seconds]
Swyper has quit [Remote host closed the connection]
nowhere_man has joined #ruby
FastJack has joined #ruby
t0x has quit [Quit: Connection closed for inactivity]
cisco has quit [Quit: leaving]
c-c has joined #ruby
<c-c> Evening ghosts
<c-c> time to continue monologue on writing a proc with named pipe message box
<c-c> last weekkie I got this far, its only about 10% pseudocode https://gist.github.com/csmr/5c0da68094e8112c4624f457f180be24
<c-c> so next I will attempt to have a gold spike, ie no-brains procs with message boxes using the fastest IPC method (outside shared memory)
Zarthus_ is now known as notZarthus
ua has quit [Ping timeout: 268 seconds]
rippa has joined #ruby
t0x has joined #ruby
<amosbird> hi, how can I make ruby write to stdout and to a log file ?
<havenwood> amosbird: Are you familiar with Logger?
<amosbird> nope
<amosbird> I don't know ruby at all
<havenwood> &ri Logger
<havenwood> c-c: I'm curious - what's the advantage over communicating over say a UNIXSocket?
<amosbird> hmm, too complicated
<amosbird> I'll use tee instead
<havenwood> amosbird: That works!
<amosbird> ?
<c-c> havenwood: if the socket takes 25 ms, named pipe takes 4 ms
<havenwood> c-c: mmmm, interesting...
<c-c> (shared memory takes like 0,1 ms)
<c-c> also, I'm just learning stuff
<c-c> 8)
<havenwood> c-c: I used to have a gem for IPC: https://github.com/havenwood/ifuture#usage
ua has joined #ruby
<havenwood> inter-process futures
<havenwood> amosbird: I just meant, no issue with just using tee. The simplest thing that can possibly work is a fine choice.
alem0lars has joined #ruby
axsuul has quit [Ping timeout: 246 seconds]
<havenwood> amosbird: Consider `warn` in place of `STDERR.puts`
<c-c> yeah my approach is all wrongf
<havenwood> c-c: yeah, it seemed like a nice approach to me too
<havenwood> c-c: I should maybe undeprecate ifuture now that Rob has revived ichannel.
<c-c> yeah I started this rewrite because I kept having problems opening the pipe correctly, Should just open both ends at once and pass the handles around.
alem0lars has quit [Ping timeout: 250 seconds]
axsuul has joined #ruby
sameerynho has joined #ruby
cnsvc_ has joined #ruby
jottr has quit [Ping timeout: 250 seconds]
jottr has joined #ruby
postmodern has joined #ruby
sylario has quit [Quit: Connection closed for inactivity]
cthulchu has joined #ruby
<barg> would anybody use byebug over pry-byebug, if so, why?
<barg> like, is pry-byebug meant to be an improvement like byebug with pry features?
tdy1 has joined #ruby
renich has joined #ruby
sauvin has quit [Remote host closed the connection]
<havenwood> barg: The reason to use pry-byebug is all of pry's features.
<havenwood> barg: The reason to use byebug alone is for the additional features that pry-byebug doesn't support.
themsay has joined #ruby
nchambers has joined #ruby
cnsvc_ has quit [Remote host closed the connection]
cnsvc_ has joined #ruby
themsay has quit [Ping timeout: 250 seconds]
agent_white has joined #ruby
ravenous_ has joined #ruby
Pisuke has quit [Ping timeout: 246 seconds]
Sembei has joined #ruby
renich_ has joined #ruby
renich has quit [Ping timeout: 246 seconds]
cthulchu_ has joined #ruby
renich_ is now known as renich
<amosbird> hi
<amosbird> how can I merge these two list
<amosbird> apps = Dir["bench*absl_Hash"].sort.uniq
<amosbird> apps = Dir["bench*robin_hood_hash"].sort.uniq
cthulchu has quit [Ping timeout: 258 seconds]
<leftylink> amosbird: if you just want to concatenate them, not caring about uniqueness, the + operator will do. if you want to deduplicate, try | (or I guess you could + and then .uniq, but unnecessary!)
<amosbird> place | at wher
<leftylink> &>> [ ["a", "b"] + ["b", "c"], ["a", "b"] | ["b", "c"] ]
<rubydoc> # => [["a", "b", "b", "c"], ["a", "b", "c"]] (https://carc.in/#/r/6e5o)
<leftylink> the two possible things you might want to do
<amosbird> hmm
<amosbird> apps = Dir[["bench*absl_Hash"] | ["bench*robin_hood_hash"]].sort.uniq
<amosbird> this doesn't work
duderono_ has joined #ruby
<leftylink> of course it doesn't, but that wasn't what you were asking
<leftylink> you were asking how to combine the results of the two Dir calls, not their inputs
<amosbird> leftylink: ok
duderonomy has quit [Ping timeout: 250 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
<havenwood> amosbird: Dir["bench*{absl_H,robin_hood_h}ash"]
jyaworski has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
jyaworski has quit [Ping timeout: 255 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
djdduty has joined #ruby
tdy1 is now known as tdy
AJA4350 has joined #ruby
skryking has quit [Quit: Leaving]
gravitation has joined #ruby
wilbert has joined #ruby
gravitation has quit [Client Quit]
tdy has quit [Ping timeout: 246 seconds]
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ravenousmoose has joined #ruby
jottr has quit [Quit: WeeChat 2.3]
ams__ has quit [Quit: Connection closed for inactivity]
t0x has quit [Quit: Connection closed for inactivity]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Puppet_ has joined #ruby
cd has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Fernando-Basso has joined #ruby
ldnunes has quit [Quit: Leaving]
tdy has joined #ruby
AJA4350 has quit [Ping timeout: 255 seconds]
Fusl has quit [Excess Flood]
Fusl has joined #ruby
cnsvc_ has joined #ruby
themsay has joined #ruby
AJA4350 has joined #ruby
wilbert has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
bmurt has joined #ruby
sameerynho has quit [Ping timeout: 245 seconds]
tdy has quit [Ping timeout: 258 seconds]
moei has quit [Quit: Leaving...]
kapil____ has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
jcalla has quit [Ping timeout: 244 seconds]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has joined #ruby
timeless has quit [Disconnected by services]
_whitelogger has quit [*.net *.split]
teej has quit [*.net *.split]
ec has quit [*.net *.split]
SegFaultAX has quit [*.net *.split]
renich has quit [Ping timeout: 255 seconds]
_whitelogger has joined #ruby
<Darmani> I need to look at the sort_by documentation.
<leftylink> nevertheless, yes, reading about sort_by is still encouraged
<leftylink> sort_by will not explicitly mention what's going on when you have its block yield an array, but it is the consequence of the fact of how arrays compare against each other
sagax has quit [Ping timeout: 245 seconds]
<Darmani> Bear with me guys
<Darmani> What's the correct way to write line 12?
jyaworski has quit [Ping timeout: 268 seconds]
<havenwood> barg: For example, if you want to go right into exploring the stack without executing any code. You can just give the filename with `byebug` like `byebug hola.rb`. I'd image most folk use pry-byebug since Pry is popular.
<leftylink> if it is a requirement tha tyou use <=>, I suppose you'd have to say `something <=> other.something`, where the `something` is what we discussed above w/ the two-element array
<leftylink> in which case sort_by would not come into play
<leftylink> sort_by would only come into play if we have something like `%w(A+ F B- B B+).sort_by { |g| ... }`
<Darmani> leftylink: It's not a requirement. I've just never done this before.
<havenwood> &>> perfect = 'A+'; [perfect, perfect.next, perfect.chr.next, perfect.chr.next+?-, perfect.chr.next.next.next.next.next]
<rubydoc> # => ["A+", "B+", "B", "B-", "F"] (https://carc.in/#/r/6e7c)
<leftylink> well, at least the benefit of using <=> would be that you'd be able to get the other comparison ops for free!
<leftylink> so, given that it is not required, that would be the deciding factor of whether to use it
<Darmani> true