00:01
hololeap_ is now known as hololeap
00:10
dviola has quit [Ping timeout: 245 seconds]
00:12
dviola has joined #ruby
00:42
puts has quit [Quit: Czesc]
01:04
dviola has quit [Ping timeout: 265 seconds]
01:16
dviola has joined #ruby
01:35
Munto has quit [Ping timeout: 252 seconds]
01:42
reset has joined #ruby
01:49
Munto has joined #ruby
01:54
mrkz_c has joined #ruby
02:06
joenoon has quit [Ping timeout: 245 seconds]
02:06
itok_ has quit [Ping timeout: 240 seconds]
02:06
MachinShin_ has quit [Ping timeout: 268 seconds]
02:06
pusewic|away_ has quit [Ping timeout: 268 seconds]
02:07
mrkz_c has quit [Ping timeout: 252 seconds]
02:08
caleb_ has joined #ruby
02:08
hwrd_ has quit [Ping timeout: 268 seconds]
02:08
rubin55 has quit [Ping timeout: 268 seconds]
02:08
vito has quit [Ping timeout: 268 seconds]
02:09
rubin55 has joined #ruby
02:09
keyvan has quit [Ping timeout: 268 seconds]
02:09
joenoon has joined #ruby
02:09
r3my has joined #ruby
02:09
vito has joined #ruby
02:09
JSharp has joined #ruby
02:09
itok_ has joined #ruby
02:10
mrkz_c has joined #ruby
02:10
pjlsergeant has joined #ruby
02:10
keyvan has joined #ruby
02:10
JayDoubleu has joined #ruby
02:10
integral has joined #ruby
02:10
jposer has joined #ruby
02:10
hwrd_ has joined #ruby
02:13
hwrd_ is now known as hwrd
02:23
pusewic|away_ has joined #ruby
02:24
MachinShin_ has joined #ruby
03:20
lad has quit [Ping timeout: 245 seconds]
04:40
_whitelogger has joined #ruby
05:31
jpw has joined #ruby
06:46
CrazyEddy has quit [Ping timeout: 245 seconds]
07:00
CrazyEddy has joined #ruby
07:31
Rounin has joined #ruby
07:44
mrkz_c has quit [Quit: Connection closed for inactivity]
07:51
Tempesta has quit [Quit: See ya!]
08:02
<
nakilon >
why does it split like that?
08:04
<
nakilon >
I expected []
08:05
<
nakilon >
I need to get all URLs and substrings between them
08:11
jpw has quit [Ping timeout: 264 seconds]
08:13
<
nakilon >
should I expect it to always be [str, *[url_part1, url_part2, url_part3, str], str?]
08:13
<
nakilon >
and the :// between parts 1 and 2
08:17
<
nakilon >
oh, probably rather [[str, url_part1, url_part2, url_part3], str?]
08:22
_ht has joined #ruby
08:39
<
nakilon >
oops no, there is also an optional query match group
08:51
Tempesta has joined #ruby
08:54
<
nakilon >
weird that StringScanner#scan_until in a loop moves the pointer but does not reach the EOS
09:15
Rounin has quit [Ping timeout: 252 seconds]
09:37
faxmodem has left #ruby [leave.pl]
10:55
rhe has quit [Quit: Ping timeout (120 seconds)]
10:55
rhe has joined #ruby
10:58
rubytest has joined #ruby
10:58
<
rubytest >
I was testing some stuff and got some unexpected behaviour
10:58
<
rubytest >
https://try.ruby-lang.org/playground/#code =%23+https%3A%2F%2Fstackoverflow.com%2Fa%2F21694593%0A%0Aclass+MyArray+%3C+Array%0A++def+myeach(%26block)%0A++++each(%26block)%0A++end%0A++def+myeach2(f)%0A++++for+x+in+self%0A++++++f.call(x)%0A++++end%0A++end%0A++def+myeach3(%26blk)%0A++++for+x+in+self%0A++++++blk.call(x)%0A++++end%0A++end%0A++def+myeach4(
10:58
<
rubytest >
%26blk)%0A++++f+%3D+-%3E(x)%7Breturn+blk.call(x)%7D%0A++++for+x+in+self%0A++++++f.call(x)%0A++++end%0A++end%0Aend%0A%0Adef+test0%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++xs.each+do+%7Cx%7C%0A++++return+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+test1%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++x
10:58
<
rubytest >
s.each+do+%7Cx%7C%0A++++next+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+test2%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++xs.myeach+do+%7Cx%7C%0A++++next+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+test3%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++%23+xs.myeach2(method(%3Ayo))%0A++xs.myeach2+-%3E
10:58
<
rubytest >
+(x)+do%0A++++return+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+test4%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++xs.each+-%3E+(x)+do%0A++++return+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+test5%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++xs.myeach3+do+%7Cx%7C%0A++++return+if+x.even%3F%0A++++p+
10:58
<
rubytest >
x%0A++end%0Aend%0A%0Adef+test6%0A++xs+%3D+MyArray%3A%3A%5B%5D(1%2C+2%2C+3%2C+4%2C+5%2C+6%2C+7)%0A++xs.myeach4+do+%7Cx%7C%0A++++return+if+x.even%3F%0A++++p+x%0A++end%0Aend%0A%0Adef+yo(x)%0A++return+if+x.even%3F%0A++p+x%0Aend%0A%0Ap+%3Atest0%0Atest0%0Ap+%3Atest1%0Atest1%0Ap+%3Atest2%0Atest2%0Ap+%3Atest3%0Atest3%0A%23+p+%3Atest4%0A%23+test4%0Ap+%3Ates
10:58
<
rubytest >
t5%0Atest5%0Ap+%3Atest6%0Atest6%0A
10:59
<
rubytest >
everything upto test5 seems correct
10:59
<
rubytest >
test6 I was expecting it to print 1, 3, 5, 7 because the return keyword is inside a lambda
11:01
<
rubytest >
"Procs return from the current method, while lambdas return from the lambda itself."
11:02
<
rubytest >
Shouldn't it just return from the lambda?
11:25
<
leftylink >
true as that may be, the `return` in the block at line 77 returns from `test6`.
11:57
puts has joined #ruby
11:58
puts has quit [Client Quit]
11:58
puts has joined #ruby
12:17
___nick___ has joined #ruby
12:21
<
rubytest >
leftylink, it does?
12:21
<
rubytest >
I thought return was a keyword
12:22
<
rubytest >
Exits a method. See methods" hmmm
12:22
<
rubytest >
leftylink so what's the correct way to convert a block into a lambda?
12:26
<
rubytest >
or I guess in this case the return keyword in the block will always refer to the test6 method
12:27
puts has quit [Quit: Czesc]
12:33
<
leftylink >
I don't understand the meaning of the phrase "convert a block into a lambda" in the context of the code
https://bpa.st/2EVQ , so I'm unable to provide an answer at this time without further clarification
12:36
rubytest has quit [Quit: Client closed]
12:54
___nick___ has joined #ruby
12:54
___nick___ has quit [Client Quit]
12:56
___nick___ has joined #ruby
12:56
lipoqil has joined #ruby
13:04
puts has joined #ruby
13:25
hololeap has quit [Ping timeout: 276 seconds]
13:26
hololeap has joined #ruby
13:45
pwnd_sfw has quit [Quit: Ping timeout (120 seconds)]
13:47
CrazyEddy has quit [Ping timeout: 264 seconds]
13:48
pwnd_sfw has joined #ruby
14:00
Tempesta has quit [Quit: See ya!]
14:05
Tempesta has joined #ruby
14:08
perrierjouet has quit [Quit: WeeChat 3.3]
14:11
puts has quit [Ping timeout: 245 seconds]
14:11
puts has joined #ruby
14:19
CrazyEddy has joined #ruby
14:40
CrazyEddy has quit [Ping timeout: 245 seconds]
14:58
CrazyEddy has joined #ruby
15:07
puts has quit [Quit: Czesc]
15:45
b08x has joined #ruby
16:36
Tempesta has quit [Quit: See ya!]
17:00
reset has quit [Read error: Connection reset by peer]
17:07
Tempesta has joined #ruby
17:08
Pixi_ is now known as Pixi
17:09
<
nakilon >
lol that copypasta
17:11
<
nakilon >
block is a syntax sugar for lambda, not vice versa so he shouldn't want to convert in that direction
17:11
<
nakilon >
he just needed to use next ....
17:16
teclator has joined #ruby
17:24
fredlinhares has joined #ruby
17:29
puts has joined #ruby
17:33
puts has quit [Client Quit]
17:37
swaggboi has quit [Quit: C-x C-c]
17:40
Oxfuxxx has joined #ruby
17:44
swaggboi has joined #ruby
17:53
weaksauce has quit [Ping timeout: 264 seconds]
18:13
dviola has quit [Changing host]
18:13
dviola has joined #ruby
18:30
weaksauce has joined #ruby
18:43
Milos has joined #ruby
18:48
AndrewYu has quit [Remote host closed the connection]
18:49
AndrewYu has joined #ruby
18:50
Oxfuxxx has quit [Ping timeout: 264 seconds]
18:53
reset has joined #ruby
18:58
pwnd_sfw has quit [Quit: Ping timeout (120 seconds)]
18:58
pwnd_sfw has joined #ruby
19:03
jpw has joined #ruby
19:07
Oxfuxxx has joined #ruby
19:15
lad has joined #ruby
19:53
jpw has quit [Remote host closed the connection]
20:04
gcd has joined #ruby
20:04
lad has quit [Remote host closed the connection]
20:05
graywolf has joined #ruby
20:11
roshanavand has joined #ruby
20:16
_ht has quit [Remote host closed the connection]
20:21
Xeago has quit [Ping timeout: 250 seconds]
20:36
phenom_ is now known as phenom
21:27
fredlinhares has quit [Quit: WeeChat 2.8]
21:44
b08x has quit [Quit: Leaving]
21:57
graywolf has quit [Quit: WeeChat 3.3]
22:00
Rounin has joined #ruby
22:34
roshanavand has quit [Ping timeout: 264 seconds]
22:37
roshanavand has joined #ruby
22:50
<
newton >
TIL there is a try.ruby-lang.org tho
22:58
Rounin has quit [Ping timeout: 264 seconds]
23:44
Munto has quit [Ping timeout: 252 seconds]
23:57
Munto has joined #ruby
23:59
hololeap has quit [Remote host closed the connection]