<aesthe>
I'm reading some code in ruby and noticed a line that is like: variable = (var_that_is_an_int - other_var_that_is_an_int). Why would the parentheses need to be there?
<havenwood>
aesthe: they don't need to be. remove them.
<havenwood>
aesthe: you *can* just add a ton of parens, just like math or writing.
<havenwood>
aesthe: `=` is lower precedence than `-` so the assignment happens after the subtraction.
TCZ has quit [Quit: Leaving]
<havenwood>
aesthe: (Just like with algebra.)
<havenwood>
And you can add unnecessary parens when precedence is clear, also just like algebra.
moeSizlak has joined #ruby
<moeSizlak>
excuse teh noob question. in this html .erb template file, am i allowed to have local variables like in this pic: https://i.imgur.com/25MHxkr.png
<moeSizlak>
it seems like these variables are not accessible later in the erb file, in different <% %> blocks
<adam12>
moeSizlak: It's because they're in a block, which means they are scoped to tha tblock.
<adam12>
moeSizlak: Actually, you didn't show the whole file. If you're in the @prcrs.each_with_index block, they should be available. If you're outside of the block, then likely not.
<havenwood>
&>> require 'erb'; ERB.new('<% (1..10).each do |n| %><%= n %><%= n %><% end %>').result(binding)
<havenwood>
&>> require 'erb'; ERB.new('<% (1..10).each do |n| %><%= n %><% end %><%= n %>').result(binding)
<rubydoc>
stderr: (erb):1:in `<main>': undefined local variable or method `n' for main:Object (NameError)... check link for more (https://carc.in/#/r/9v4f)
<havenwood>
moeSizlak: To illustrate what adam12 said ^, the variable is available repeatedly, but not outside the scope where it'd be visible in Ruby.
Rounin has joined #ruby
<moeSizlak>
adam12, even in the each_with_index block, theyre not available
<adam12>
moeSizlak: Paste the entire block in something like dpaste.de so we can take a look.
<adam12>
moeSizlak: What's the error?
<moeSizlak>
theres no error, it just acts like the variables dont exist
<havenwood>
meimeix: You don't have an = sign.
<havenwood>
meimeix: <%=
<havenwood>
meimeix: If the local variable wasn't available, it'd blow up with an error saying so.
<moeSizlak>
i dont need a = there
<havenwood>
moeSizlak I mean, ooops
<havenwood>
sorry meimeix
<adam12>
moeSizlak: Can you share the full code? Without it, not sure we can give a good answer without an exception backtrace.
<adam12>
moeSizlak: instead of asssigning `nil` to mystatus and mystatusHTML, assign something random like "SIMPSONS" and see if it outputs.
<havenwood>
?gist moeSizlak
<ruby[bot]>
moeSizlak: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<havenwood>
isene: Is it feature complete now? Want any code review?
banisterfiend has joined #ruby
cthulchu_ has joined #ruby
<isene>
I've been at this for only 25 hours so far, and I do want more features (like Readline input in bottom window, search via "/", maybe fzf integration... but yeah, if you want to review the code, I'll be happy to have the input. I'm not really a Ruby developer even though I've used the language for 15 years, so anything I can learn is cool :-)
banisterfiend has quit [Read error: Connection reset by peer]
<havenwood>
Usually requires go at the top. I think that's worth leaning towards unless there's a reason not to.
<havenwood>
isene: I'd say `Dir.home` instead of `ENV['HOME']`.
<isene>
You're on 🔥. Cool. Would you mind putting it all into an email (easier to use as a to-do list)? (g@isene.com)
<havenwood>
isene: Nifty project. Happy birthday!
<isene>
👍🎂
chouhoulis has quit [Remote host closed the connection]
summerisle has joined #ruby
markong has joined #ruby
justache is now known as justHaunted
markong has quit [Remote host closed the connection]
markong has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
joshuacronemeyer has joined #ruby
davispuh has joined #ruby
blackmesa has joined #ruby
RiPuk has joined #ruby
cnsvc has joined #ruby
aesthe has quit [Quit: Leaving]
<crankharder>
is ruby known to read from the RUBY_EXTRA_CONFIGURE_OPTIONS env variable when configuring? asking because I see some Stack overflows referencing it, but it doens't appear to work for me in the context of installing rubyies with rvm on OSX. Thanks!
<adam12>
crankharder: No reference to it in the Ruby source. Might just be an rvm thing.
moeSizlak has left #ruby ["Leaving"]
<havenwood>
crankharder: Looks like an asdf thing.
akem has quit [Remote host closed the connection]
ldepandis has joined #ruby
akem has joined #ruby
landakram has joined #ruby
cthulchu_ has quit [Ping timeout: 256 seconds]
stryek has joined #ruby
cthulchu has joined #ruby
cnsvc has quit [Quit: WeeChat 2.9]
rippa has joined #ruby
landakram has quit [Ping timeout: 260 seconds]
impermanence has quit [Ping timeout: 256 seconds]
crankharder has quit [Ping timeout: 256 seconds]
go|dfish has quit [Remote host closed the connection]
go|dfish has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
roshanavand has quit [Ping timeout: 260 seconds]
hiroaki has joined #ruby
imode has joined #ruby
cd has joined #ruby
ap4y has joined #ruby
weaksauce has joined #ruby
powerhouse has quit [Read error: Connection reset by peer]
crankharder has joined #ruby
powerhouse has joined #ruby
TCZ has joined #ruby
blackmesa has quit [Quit: WeeChat 2.9]
crankharder has quit [Ping timeout: 260 seconds]
burgestrand has joined #ruby
ellcs has joined #ruby
burgestrand has quit [Quit: burgestrand]
crankharder has joined #ruby
summerisle has quit [Quit: In my vision, I was on the veranda of a vast estate, a palazzo of some fantastic proportion.]
summerisle has joined #ruby
chouhoulis has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roshanavand has joined #ruby
dcunit3d has quit [Ping timeout: 272 seconds]
ur5us has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has quit [Ping timeout: 246 seconds]
dcunit3d has joined #ruby
Seich has joined #ruby
howdoi has joined #ruby
acovrig has joined #ruby
<acovrig>
I feel like I'm missing something simple, how is this an "invalid date"? `DateTime.strptime('10/1/2020 01:02:03', '%D %T')`
Seich has quit [Quit: Gone fishing.]
Seich has joined #ruby
tubbo has joined #ruby
<adam12>
acovrig: Bug maybe?
<adam12>
acovrig: Actually it's not; %D won't take a 4 digit year.
<adam12>
acovrig: Ironically, it will if it's on it's own. But once you put it with ` %T` it complains.
<acovrig>
OK, I was gonna say, but it does (as I test on it's own w/out the time) lol