00:02
mtm has quit [Ping timeout: 272 seconds]
00:05
Guest75 has joined #ruby
00:05
mtm has joined #ruby
00:07
Guest75 has quit [Client Quit]
00:08
some14u has joined #ruby
00:13
some14u has quit [Ping timeout: 265 seconds]
00:40
Guest75 has joined #ruby
00:45
Guest75 has quit [Quit: Client closed]
00:46
Guest75 has joined #ruby
00:49
jace_ has quit [Remote host closed the connection]
00:50
Guest75 has quit [Client Quit]
00:50
mjacob has joined #ruby
00:58
some14u has joined #ruby
01:05
some14u has quit [Ping timeout: 252 seconds]
01:18
some14u has joined #ruby
01:23
some14u has quit [Ping timeout: 246 seconds]
01:25
<
mjacob >
Where can I find an exact description of the syntax of do blocks, especially their precedence relative to method calls?
01:36
desnudopenguino has quit [Ping timeout: 246 seconds]
02:03
<
mjacob >
weaksauce: I don’t see method calls and do blocks in the table.
02:04
<
weaksauce >
last line
02:04
<
weaksauce >
{ ... } blocks have priority below all listed operations, but do ... end blocks have lower priority.
02:04
<
mjacob >
weaksauce: I don’t really understand “{ ... } blocks have priority below all listed operations, but do ... end blocks have lower priority.”.
02:07
<
weaksauce >
do end has lower than {} does
02:08
<
mjacob >
Is it even possible to mix do blocks and {} blocks?
02:09
<
weaksauce >
var.foo 1 do end is valid while var.foo 1 { } would syntax error
02:09
<
weaksauce >
what do you mean possible to mix?
02:11
<
weaksauce >
you can do var.foo(1) { ... }
02:12
<
weaksauce >
so if you mean mix in that way they are both blocks yeah
02:12
<
mjacob >
I’ve read in various places that do blocks have lower precedence than {} blocks. Unless I’m missing something, this is only relevant if an expression contains both do blocks and {} blocks.
02:12
<
weaksauce >
it's relevant when you are calling it like above
02:13
<
weaksauce >
i think it's good form to generally use parens though
02:13
<
weaksauce >
even with do end
02:18
<
mjacob >
Let’s take an example which is clearer. Of course * has a higher precedence than +. In expressions `a * b
** c` and `a + b ** c` that fact is not relevant because there’s only one of them. Do blocks and {} blocks don’t mix, so I don’t understand how the statement “do blocks have lower precedence than {} blocks” makes sense.
02:25
<
mjacob >
My original example was `expect(…).to have_xpath(…) do … end` where the block is passed to the `.to` method (I think) vs. `expect(…).to receive(…).with(…) do … end` where the block is passed to the `.with` method (I think).
02:27
<
mjacob >
What I’m looking for is a solid mental model (for me and my colleagues), some coding standard to avoid confusion and (ideally) a way to enforce that coding style automatically.
02:29
some14u has joined #ruby
02:30
<
weaksauce >
the block is passed to the last method there
02:30
<
weaksauce >
expect(…).to have_xpath(…) do … end
02:30
<
weaksauce >
the block would be passed to have_xpath
02:30
<
weaksauce >
mjacob ^
02:31
<
weaksauce >
the only way to hijack that order is to use parens
02:33
some14u has quit [Ping timeout: 252 seconds]
02:42
<
weaksauce >
surprising
02:44
<
weaksauce >
i guess they meant it when they said lowest priority
02:47
some14u has joined #ruby
02:49
gastus has quit [Ping timeout: 246 seconds]
02:50
gastus has joined #ruby
02:51
<
weaksauce >
the docs are just about the worst too so that doesn't help
02:53
some14u has quit [Ping timeout: 246 seconds]
02:58
<
mjacob >
weaksauce: I’ll call it a day and think about this more tomorrow. Thanks for the pointers!
03:07
some14u has joined #ruby
03:12
some14u has quit [Ping timeout: 260 seconds]
03:27
some14u has joined #ruby
03:31
some14u has quit [Ping timeout: 246 seconds]
03:37
konsolebox has joined #ruby
03:47
some14u has joined #ruby
03:55
some14u has quit [Ping timeout: 252 seconds]
04:10
some14u has joined #ruby
04:14
some14u has quit [Ping timeout: 246 seconds]
04:25
ih8u1 is now known as ih8u
04:29
cappy has joined #ruby
04:30
some14u has joined #ruby
04:41
some14u has quit [Ping timeout: 260 seconds]
04:42
Linux_Kerio has joined #ruby
05:04
grenierm has joined #ruby
05:12
some14u has joined #ruby
05:16
some14u has quit [Ping timeout: 255 seconds]
05:20
some14u has joined #ruby
05:25
some14u has quit [Ping timeout: 246 seconds]
05:39
some14u has joined #ruby
05:45
some14u has quit [Ping timeout: 252 seconds]
06:28
shiru has joined #ruby
06:49
Rounin has quit [Ping timeout: 260 seconds]
06:51
cappy has quit [Quit: Leaving]
07:02
Rounin has joined #ruby
07:03
ua_ has joined #ruby
07:13
smp has quit [Ping timeout: 246 seconds]
07:15
smp has joined #ruby
07:31
some14u has joined #ruby
07:33
Linux_Kerio has quit [Ping timeout: 252 seconds]
07:36
some14u has quit [Ping timeout: 260 seconds]
08:03
TomyWork has joined #ruby
08:11
kiwi_36 has quit [Remote host closed the connection]
08:48
smp has quit [Ping timeout: 252 seconds]
08:49
smp has joined #ruby
10:28
shiru has quit [Remote host closed the connection]
10:42
grenierm has quit [Ping timeout: 256 seconds]
10:44
Guest75 has joined #ruby
11:00
Guest75 has quit [Quit: Client closed]
11:02
Guest75 has joined #ruby
11:38
Guest75 has quit [Quit: Client closed]
11:45
Linux_Kerio has joined #ruby
11:55
greybeard has joined #ruby
12:02
mtm has quit [Ping timeout: 276 seconds]
12:06
mtm has joined #ruby
12:29
gastus has quit [Ping timeout: 264 seconds]
14:06
gastus has joined #ruby
14:16
user71 has joined #ruby
14:19
Rounin has quit [Remote host closed the connection]
14:23
Guest75 has joined #ruby
14:28
some14u has joined #ruby
14:33
Rounin has joined #ruby
14:33
Rounin has quit [Changing host]
14:33
Rounin has joined #ruby
14:51
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:10
Guest75 has quit [Ping timeout: 256 seconds]
15:29
joast has quit [Quit: Leaving.]
16:25
konsolebox has quit [Quit: .]
16:31
aindilis has joined #ruby
17:11
some14u has joined #ruby
17:22
Hammdist has joined #ruby
17:23
<
Hammdist >
how do I default in ruby? like x={}; y = x[0] ?? 0 where ?? is borrowed from typescript and does not truly work in ruby?
17:24
<
Hammdist >
actually || seems to do what I want
17:44
ua_ has quit [Ping timeout: 265 seconds]
17:55
ua_ has joined #ruby
18:02
greybeard has quit [Changing host]
18:02
greybeard has joined #ruby
18:03
greybeard has quit [Quit: Leaving.]
18:04
greybeard has joined #ruby
18:12
TomyWork has quit [Remote host closed the connection]
18:15
CRISPR has joined #ruby
18:38
rvalue- has joined #ruby
18:39
rvalue has quit [Ping timeout: 272 seconds]
18:46
rvalue- is now known as rvalue
18:52
grenierm has joined #ruby
18:59
<
adam12 >
Hammdist: || or ||= will work
18:59
<
adam12 >
Hammdist: The catch being that `nil` and `false` are both `falsey`, which means you might have issues where you expect those as values.
19:00
<
adam12 >
Hammdist: The solution there being key?`. `x[0] = 0 unless x.key?(0)`
19:29
<
weaksauce >
i use fetch generally for that with a default value like x.fetch(0, 0)
19:30
<
weaksauce >
all of those work though
19:31
CRISPR has quit [Ping timeout: 260 seconds]
19:33
CRISPR has joined #ruby
20:14
user71 has quit [Quit: Leaving]
20:15
Vaevictu1 has joined #ruby
20:15
<
Vaevictu1 >
do people still use RVM ?
20:15
Vaevictu1 is now known as Vaevictus
20:16
<
Vaevictus >
i've been using it for years, and apparently now it won't let user installs happen without trying to update my OS
20:16
CRISPR has quit [Ping timeout: 252 seconds]
20:17
<
Vaevictus >
nm, seems to have been a feature "autolibs"
20:30
<
adam12 >
Vaevictus: I don't think it's the
_most_ popular anymore.
20:30
<
adam12 >
I've switched to using Mise just because it manages bun/node/everything else too, and it's one less tool.
20:33
CRISPR has joined #ruby
20:36
desnudopenguino has joined #ruby
20:51
desnudopenguino1 has joined #ruby
20:53
desnudopenguino has quit [Ping timeout: 260 seconds]
20:53
desnudopenguino1 is now known as desnudopenguino
20:56
Linux_Kerio has quit [Ping timeout: 248 seconds]
21:08
graywolf has joined #ruby
21:09
joako has quit [Quit: quit]
21:11
joako has joined #ruby
21:17
cappy has joined #ruby
21:51
greybeard has quit [Quit: Leaving.]
21:51
desnudopenguino1 has joined #ruby
21:54
desnudopenguino has quit [Ping timeout: 246 seconds]
21:54
desnudopenguino1 is now known as desnudopenguino
22:00
ruby[bot] has quit [Remote host closed the connection]
22:00
ruby[bot] has joined #ruby
22:02
CRISPR has quit [Ping timeout: 265 seconds]
22:06
Pixi` has quit [Quit: Leaving]
22:29
joast has joined #ruby
22:39
finsternis has joined #ruby
23:07
graywolf has quit [Quit: WeeChat 4.4.1]