adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
drincruz has joined #ruby
mtr has joined #ruby
drincruz has quit [Ping timeout: 252 seconds]
ur5us has quit [Ping timeout: 252 seconds]
ur5us has joined #ruby
drincruz has joined #ruby
drincruz has quit [Ping timeout: 252 seconds]
gr33n7007h has quit [Ping timeout: 265 seconds]
drincruz has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]
finsternis has joined #ruby
jetchisel has joined #ruby
leah2 has quit [Read error: Connection reset by peer]
drincruz_ has joined #ruby
drincruz has quit [Ping timeout: 252 seconds]
<bandithijo> riceandbeans: `["foo", "bar", "baz", "biff"].include? foobar` ?
<rg> maybe also.. foobar = [foo, bar, baz, biff].find(&:itself)
<rg> i think the longer form is going to be clearest.
mtr has quit [Quit: Leaving...]
<newton> TIL itself
<newton> though you lose the short circuiting of || if any of foo bar baz biff were long running methods
Tempesta has quit [Quit: See ya!]
drincruz has joined #ruby
drincruz_ has quit [Ping timeout: 258 seconds]
<rg> i always thought itself was weird but yeah it has its place i guess
Tempesta has joined #ruby
easbarbosa has joined #ruby
easbarbosa has quit [Remote host closed the connection]
easbarbosa has joined #ruby
lunarkitty has joined #ruby
postmodern has joined #ruby
easbarbosa has quit [Ping timeout: 240 seconds]
Rounin has quit [Ping timeout: 252 seconds]
ged has quit [Quit: WeeChat 3.1]
ged has joined #ruby
ur5us has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
ged has quit [Quit: I don't settle for anything less than zebras.]
ged has joined #ruby
jhawthorn_ has joined #ruby
jhawthorn has quit [Ping timeout: 246 seconds]
dibber has quit [Ping timeout: 246 seconds]
lunarkitty has quit [Quit: Connection closed for inactivity]
jmcgnh has quit [Ping timeout: 265 seconds]
jmcgnh has joined #ruby
_ht has joined #ruby
unyu has joined #ruby
lucf117 has quit [Remote host closed the connection]
sagax has quit [Excess Flood]
postmodern has quit [Quit: Leaving]
teclator has joined #ruby
gr33n7007h has quit [Ping timeout: 252 seconds]
bandithijo has quit [Quit: WeeChat 3.2-rc1]
leah2 has joined #ruby
Garb0 has joined #ruby
nolesswrong has joined #ruby
Garb0 has quit [Remote host closed the connection]
sam113101 has quit [Remote host closed the connection]
sam113101 has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Quit: Garb0]
drincruz has quit [Ping timeout: 272 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.2]
unmanbearpig has joined #ruby
Rounin has joined #ruby
Garb0 has joined #ruby
drincruz has joined #ruby
bandithijo has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
isekaijin has quit [Quit: WeeChat 3.2]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
drincruz has joined #ruby
bandithijo has quit [Quit: WeeChat 3.2-rc1]
bandithijo has joined #ruby
jetchisel has quit [Ping timeout: 268 seconds]
bandithijo has quit [Quit: WeeChat 3.2-rc1]
bandithijo has joined #ruby
Garb0 has quit [Ping timeout: 265 seconds]
crawler has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Quit: Garb0]
crawler has quit [Ping timeout: 252 seconds]
crawler has joined #ruby
crawler has quit [Excess Flood]
crawler has joined #ruby
crawler has quit [Excess Flood]
crawler has joined #ruby
crawler has quit [Excess Flood]
crawler has joined #ruby
crawler has quit [Excess Flood]
gr33n7007h has joined #ruby
Guest6 has joined #ruby
Guest6 has quit [Client Quit]
bandithijo has quit [Quit: WeeChat 3.2-rc1]
unmanbearpig has quit [Read error: Connection reset by peer]
AriT93 has joined #ruby
<jidar> jwr adam12, yall could init the repo bare I think? so it doesn't contain all the old commits https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ maybe can help with something like, `git clone --filter=tree:0 <url>` or similar? curious though
<jidar> --depth=1 rather
jetchisel has joined #ruby
drincruz_ has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
teclator has quit [Remote host closed the connection]
drincruz_ has quit [Ping timeout: 265 seconds]
drincruz_ has joined #ruby
ur5us has joined #ruby
bonhoeffer has joined #ruby
<bonhoeffer> anyone get mach-o but wrong architecture rails on m1 when trying to run stuff
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
orbyt has joined #ruby
<orbyt> Hey folks
<orbyt> My Ruby skills are quite rusty - is there any scenario where `primary_search_term` would already have a value if this is the first reference to it in a module?
<orbyt> My understanding of ||= is "if variable has no existing variable assign it this"
<adam12> orbyt: primary_search_term is a local, so likely not.
<adam12> bonhoeffer: exact error?
<adam12> orbyt: and your understanding is _slightly_ wrong. It's basically if variable is nil or false.
<adam12> orbyt: Show more code and we could probably look into it a bit more deeply, since a lot of context is lost by just showing the single statement.
<orbyt> So if `primary_search_term` was null or a boolean == false, assign the following?
<orbyt> Yea, I just saw that operator in a PR and it struck me as an error because I couldn't find how it could possible already have a value
<orbyt> Wanted to check here before bringing it up in the PR
<adam12> orbyt: Correct. It's often used for memoizing a value of a method call. `def foo; @foo ||= expensive_call_to_get_foo; end`.
<orbyt> Cool, thanks
<orbyt> We'll see what the PR submitter thinks
<adam12> orbyt: If it's not passed into the method, and this is the first time it's being used, the ||= is probably unnecessary. But again, we lose a lot of context just seeing the small piece of the puzzle.
<orbyt> Yea, I did a path search in rubymine and it's only used twice; there and then used again to reference a property: `term_display_name: primary_search_term.provider_description`
<adam12> The `||=` is likely not hurting anything over just `=`, but it's definitely a source of indirection.
<adam12> Maybe the entire method you pulled it from is wrong? The use of `#map` there looks wrong...
<adam12> I'd expect `find` there.. since presumably the assignment would be a single value and not an array of nil's.
<orbyt> Hmm, okay let me post more code
Garb0 has joined #ruby
<orbyt> L12-29 are the new additions
<orbyt> +63
<adam12> primary_search_term definitely doesn't need an or-equals
<orbyt> Cool, figured as much.
<adam12> I think the #map is working because it always returns a value.
<adam12> if it was `#find` and never matched, line 63 would crash with NoMethodError.
<adam12> So it's a happy accident that it works
<adam12> (if it was `#map` and never matched it would be an error too)
<adam12> This whole file would benefit of being a class with smaller methods, imho.
bonhoeffer has quit [Ping timeout: 268 seconds]
<orbyt> Ok, made some comments and noted the issue with map
<orbyt> Thanks for taking a look - I don't do server dev at this company but have a very small amount of ruby experience from years ago
drincruz has joined #ruby
Garb0 has quit [Quit: Garb0]
drincruz_ has quit [Ping timeout: 255 seconds]
lunarkitty has joined #ruby
altdev has joined #ruby
altdev has quit [Client Quit]
postmodern has joined #ruby
bonhoeffer has joined #ruby
bonhoeffer has quit [Remote host closed the connection]
bonhoeffer has joined #ruby
ur5us has quit [Ping timeout: 246 seconds]
_ht has quit [Remote host closed the connection]
Garb0 has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
ikke has joined #ruby
Garb00 has joined #ruby
Garb0 has quit [Ping timeout: 255 seconds]
<ikke> ruby-magic is failing with the error Magic::MagicError (could not find any valid magic files!). If I strace a simple script, I see this: https://tpaste.us/Lm6W. Why is it trying to look for those files in that location? /usr/local/bundle/gems/ruby-magic-0.4.0/ports does not exist.
<ikke> This is in a ruby:2.7-alpine docker image
<ikke> libmagic is installed, which has the mgc file in usr/share/misc/magic.mgc
bandithijo has joined #ruby
isekaijin has joined #ruby
bonhoeffer has quit [Remote host closed the connection]
bonhoeffer has joined #ruby
bandithijo has quit [Quit: WeeChat 3.2-rc1]
bonhoeffer has quit [Remote host closed the connection]
bonhoeffer has joined #ruby
ur5us has joined #ruby
orbyt has quit [Quit: Textual IRC Client: www.textualapp.com]
bonhoeffer has quit [Ping timeout: 265 seconds]
drincruz_ has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
Garb00 has quit [Quit: Garb00]
xall has joined #ruby
drincruz_ has quit [Ping timeout: 246 seconds]
drincruz_ has joined #ruby
drincruz_ has quit [Read error: Connection reset by peer]
bonhoeffer has joined #ruby
drincruz_ has joined #ruby
FetidToot0 has joined #ruby
FetidToot has quit [Ping timeout: 272 seconds]
FetidToot0 is now known as FetidToot
bonhoeffer has quit [Ping timeout: 240 seconds]
justache has quit [Read error: Connection reset by peer]
justache has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]