00:00
spacesuitdiver has quit [Client Quit]
00:00
<
bjpenn >
any ruby ninja techniques to get it to do what i want? :P
00:00
<
bjpenn >
the reason being, the contents within the heredoc, the "string", is a complex regex expression
00:00
<
bjpenn >
i want to keep the essence of that the way it is copy/pasted
00:01
<
bjpenn >
the only thing that needs changing is "\" being "\\"
00:01
<
bjpenn >
and some fields that will become string interpolated like this: #{blah}
00:02
<
mozzarella >
are you going to create a regex object with said string? is it a valid ruby regex?
00:04
<
bjpenn >
its actuallynot regex
00:04
<
bjpenn >
its a query string for sumologic
00:04
<
bjpenn >
it contains regex though
00:05
<
bjpenn >
but i prefer the whole thing to be in a heredoc
00:05
<
bjpenn >
without me going to random characters and escaping them manually
00:06
<
havenwood >
bjpenn: how about heredoc with sprintf?
00:07
<
mozzarella >
erb template at the end of the file
00:08
<
havenwood >
bjpenn: <<~'END' % {meaning: 42}
00:09
<
mozzarella >
I think I prefer this way, actually
00:11
<
bjpenn >
nice... that might actually work
00:12
<
bjpenn >
im using heredocs as part of an erb template though
00:12
* bjpenn
crosses fingers
00:14
ubuntuisloved has joined #ruby
00:17
<
mozzarella >
bjpenn: can't it be its own template, then, and then embedded in the parent template?
00:17
<
mozzarella >
shouldn't be too hard
00:18
<
bjpenn >
yeah i suppose that would work too
00:19
ams__ has quit [Quit: Connection closed for inactivity]
00:19
nowhereman has joined #ruby
00:19
<
bjpenn >
that ruby magic didnt bode well with the erb
00:19
<
bjpenn >
thank you all for trying though! :)
00:23
<
havenwood >
fun with ERB templates!
00:23
<
havenwood >
it's interesting that Ruby's JIT uses ERB :)
00:27
blackmesa has joined #ruby
00:29
crankharder has quit [Ping timeout: 240 seconds]
00:31
ubuntuisloved has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:32
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:32
AJA4350 has quit [Ping timeout: 245 seconds]
00:32
DeadPixelz01 has quit [Ping timeout: 240 seconds]
00:34
AJA4350 has joined #ruby
00:37
renich_ has quit [Remote host closed the connection]
00:37
DeadPixelz01 has joined #ruby
00:37
orbyt_ has joined #ruby
00:42
nowhereman has quit [Ping timeout: 252 seconds]
00:45
crankharder has joined #ruby
00:47
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:56
dviola has joined #ruby
01:03
conta has joined #ruby
01:06
orbyt_ has joined #ruby
01:08
conta has quit [Ping timeout: 252 seconds]
01:08
Swyper has quit [Remote host closed the connection]
01:11
sgen has quit [Ping timeout: 252 seconds]
01:13
Swyper has joined #ruby
01:14
sidepocket has quit [Remote host closed the connection]
01:14
sidepocket has joined #ruby
01:17
bambanx has joined #ruby
01:17
r29v has quit [Quit: r29v]
01:18
Swyper has quit [Ping timeout: 255 seconds]
01:23
DeadPixelz01 has quit [Ping timeout: 240 seconds]
01:24
crankharder has quit [Ping timeout: 240 seconds]
01:26
sidepocket has quit [Ping timeout: 256 seconds]
01:29
zachk has quit [Quit: Leaving]
01:32
gix has quit [Ping timeout: 240 seconds]
01:38
renich has joined #ruby
01:38
Averna has joined #ruby
01:39
r29v has joined #ruby
01:41
r29v has quit [Client Quit]
01:42
r29v has joined #ruby
01:46
<
mjacob >
is there a builtin (or shorter / more idiomatic) version of "Enumerator.new do |y| loop do y << f() end end.lazy"?
01:47
AJA4350 has quit [Ping timeout: 245 seconds]
01:48
mangold has joined #ruby
01:55
FastJack has quit [Ping timeout: 264 seconds]
01:55
FastJack has joined #ruby
02:05
gnufied has quit [Remote host closed the connection]
02:06
Swyper has joined #ruby
02:07
SeepingN has quit [Quit: The system is going down for reboot NOW!]
02:07
sgen has joined #ruby
02:08
r29v has quit [Quit: r29v]
02:11
sylario has quit [Quit: Connection closed for inactivity]
02:12
Swyper has quit [Ping timeout: 240 seconds]
02:14
Swyper has joined #ruby
02:19
Swyper has quit [Ping timeout: 255 seconds]
02:19
Swyper has joined #ruby
02:20
Onwarion has joined #ruby
02:23
Onwarion_re has quit [Ping timeout: 246 seconds]
02:24
Swyper has quit [Ping timeout: 250 seconds]
02:35
dviola has quit [Quit: WeeChat 2.4]
02:36
<
mjacob >
i agree that we all should use (better) functional languages, but i don't really have a choice ;)
02:36
<
havenwood >
mjacob: You could make a helper method like ^ and then: repeatedly { foo }.lazy
02:42
sacomo has quit [Ping timeout: 264 seconds]
02:50
crankharder has joined #ruby
02:53
ozzloy has joined #ruby
02:53
ozzloy has quit [Changing host]
02:53
ozzloy has joined #ruby
03:01
sacomo has joined #ruby
03:01
Swyper has joined #ruby
03:07
cthulchu has quit [Ping timeout: 255 seconds]
03:09
hightower2 has quit [Ping timeout: 240 seconds]
03:10
v01d4lph4 has joined #ruby
03:11
renich_ has joined #ruby
03:12
renich has quit [Ping timeout: 245 seconds]
03:13
sgen has quit [Ping timeout: 252 seconds]
03:19
tau has joined #ruby
03:22
code_zombie has quit [Quit: Leaving]
03:22
cd has quit [Remote host closed the connection]
03:22
aqd has quit [Remote host closed the connection]
03:22
aqd_ has joined #ruby
03:23
Tempesta_ has joined #ruby
03:24
Tempesta has quit [Ping timeout: 245 seconds]
03:24
miah has quit [Ping timeout: 264 seconds]
03:24
miah has joined #ruby
03:25
orbyt_ has quit [Ping timeout: 245 seconds]
03:25
cd has joined #ruby
03:31
Tempesta_ has left #ruby ["Closing Channel, bye."]
03:31
Tempesta has joined #ruby
03:32
Qiong|AFK is now known as Qiong
03:32
Qiong is now known as Qiong|Eat
03:45
tau has quit [Remote host closed the connection]
03:49
Qiong|Eat is now known as Qiong|HalfFull
03:54
crankharder has quit [Ping timeout: 255 seconds]
03:56
duderonomy has quit [Ping timeout: 240 seconds]
03:59
duderonomy has joined #ruby
04:00
fluxAeon has joined #ruby
04:03
DTZUZO has joined #ruby
04:03
v01d4lph4 has quit [Remote host closed the connection]
04:04
v01d4lph4 has joined #ruby
04:05
braincrash has quit [Quit: bye bye]
04:07
blackmesa has quit [Ping timeout: 257 seconds]
04:09
braincrash has joined #ruby
04:13
crankharder has joined #ruby
04:22
Nicmavr has quit [Read error: Connection reset by peer]
04:24
meinside has quit [Quit: Connection closed for inactivity]
04:24
Nicmavr has joined #ruby
04:27
BTRE has quit [Ping timeout: 255 seconds]
04:28
Swyper has quit [Remote host closed the connection]
04:28
BTRE has joined #ruby
04:34
aqd_ has quit [Ping timeout: 240 seconds]
04:35
agent_white has quit [Quit: bbl]
04:37
Swyper has joined #ruby
04:40
xrexeon has quit [Ping timeout: 240 seconds]
04:41
v01d4lph4 has quit [Remote host closed the connection]
04:41
ur5us has quit [Remote host closed the connection]
04:41
Swyper has quit [Remote host closed the connection]
04:41
ur5us has joined #ruby
04:43
govg has quit [Ping timeout: 245 seconds]
04:44
v01d4lph4 has joined #ruby
04:46
ur5us has quit [Ping timeout: 240 seconds]
04:46
crankharder has quit [Ping timeout: 244 seconds]
04:48
DeadPixelz01 has joined #ruby
04:52
DaRock has quit [Ping timeout: 250 seconds]
04:57
sgen has joined #ruby
04:58
Fusl has quit [Remote host closed the connection]
04:59
Fusl has joined #ruby
05:02
RiPuk has joined #ruby
05:05
crankharder has joined #ruby
05:12
jud has joined #ruby
05:12
jud has joined #ruby
05:12
jud has quit [Changing host]
05:13
crankharder has quit [Ping timeout: 255 seconds]
05:15
crankharder has joined #ruby
05:15
Calinou has quit [Remote host closed the connection]
05:15
jmcgnh has quit [Ping timeout: 252 seconds]
05:16
Calinou has joined #ruby
05:19
rippa has joined #ruby
05:19
jmcgnh_ has joined #ruby
05:26
Swyper has joined #ruby
05:51
Swyper has quit [Remote host closed the connection]
05:53
Swyper has joined #ruby
05:55
aqd has joined #ruby
05:58
sgen has quit [Ping timeout: 252 seconds]
06:08
SeepingN has joined #ruby
06:10
evdubs_ has joined #ruby
06:11
evdubs has quit [Ping timeout: 240 seconds]
06:17
renich has joined #ruby
06:17
renich_ has quit [Ping timeout: 245 seconds]
06:18
bambanx has quit [Read error: Connection reset by peer]
06:19
bambanx has joined #ruby
06:21
Swyper has quit [Remote host closed the connection]
06:21
conta has joined #ruby
06:23
crankharder has quit [Ping timeout: 252 seconds]
06:24
Inline has quit [Quit: Leaving]
06:25
crankharder has joined #ruby
06:26
jcarl43 has quit [Quit: WeeChat 2.4]
06:37
cd has quit [Quit: cd]
06:44
aufi has joined #ruby
06:50
tdy has joined #ruby
06:50
DeadPixelz01 has quit [Quit: Leaving]
06:52
jane_booty_doe has quit [Remote host closed the connection]
06:55
reber has joined #ruby
06:56
laaron has joined #ruby
06:59
eightfold has joined #ruby
07:02
crankharder has quit [Ping timeout: 245 seconds]
07:08
qual has joined #ruby
07:08
skryking has quit [Ping timeout: 245 seconds]
07:08
<
sagax >
who use vim - what the best colorscheme for ruby?
07:10
skryking has joined #ruby
07:11
fluxAeon has quit [Ping timeout: 252 seconds]
07:13
jane_booty_doe has joined #ruby
07:14
eightfold has quit [Quit: eightfold]
07:21
fluxAeon has joined #ruby
07:21
crankharder has joined #ruby
07:22
t0xik has joined #ruby
07:25
fluxAeon has quit [Ping timeout: 240 seconds]
07:34
emilford has quit [Ping timeout: 255 seconds]
07:38
DaRock has joined #ruby
07:40
crankharder has quit [Ping timeout: 252 seconds]
07:41
<
bambanx >
hi sagax ! i use vim
07:42
hahuang6| has quit [Ping timeout: 264 seconds]
07:42
hahuang6- has joined #ruby
07:45
ur5us has joined #ruby
07:45
Xiti has quit [Ping timeout: 245 seconds]
07:45
ur5us has quit [Client Quit]
07:47
Xiti has joined #ruby
07:48
tag has quit [Quit: Connection closed for inactivity]
07:48
emilford has joined #ruby
07:49
jinie has joined #ruby
07:52
clemens3 has joined #ruby
07:53
schleppel has joined #ruby
07:54
<
bambanx >
i use vim-gotham is nice sagax
07:55
emilford has quit [Ping timeout: 245 seconds]
07:56
qual is now known as qual[away]
07:58
emilford has joined #ruby
08:02
sauvin has joined #ruby
08:03
emilford has quit [Ping timeout: 255 seconds]
08:04
emilford has joined #ruby
08:08
evdubs_ has quit [Remote host closed the connection]
08:08
lxsameer has joined #ruby
08:10
keden has joined #ruby
08:11
KeyJoo has joined #ruby
08:12
KeyJoo has quit [Max SendQ exceeded]
08:12
KeyJoo has joined #ruby
08:13
evdubs_ has joined #ruby
08:15
keden has quit [Ping timeout: 240 seconds]
08:17
tdy1 has joined #ruby
08:18
qual[away] has quit [Ping timeout: 240 seconds]
08:19
tdy has quit [Ping timeout: 245 seconds]
08:19
<
sagax >
i will try this
08:20
KeyJoo has quit [Remote host closed the connection]
08:23
KeyJoo has joined #ruby
08:23
renich has quit [Quit: renich]
08:27
suukim has joined #ruby
08:29
cnsvc has joined #ruby
08:29
suukim has quit [Remote host closed the connection]
08:39
bambanx has quit [Quit: Leaving]
08:41
suukim has joined #ruby
08:41
themsay has quit [Ping timeout: 245 seconds]
08:41
keden has joined #ruby
08:46
keden has quit [Ping timeout: 255 seconds]
08:49
eightfold has joined #ruby
08:49
ellcs1 has joined #ruby
08:52
eightfold_ has joined #ruby
08:53
eightfold has quit [Ping timeout: 268 seconds]
08:57
eightfold_ has quit [Ping timeout: 268 seconds]
08:57
aupadhye has joined #ruby
08:58
eightfold has joined #ruby
08:58
qual has joined #ruby
09:01
cnsvc has quit [Ping timeout: 256 seconds]
09:01
jane_booty_doe has joined #ruby
09:01
eightfold has quit [Client Quit]
09:02
qual is now known as qual[away]
09:02
sylario has joined #ruby
09:02
hightower2 has joined #ruby
09:06
ellcs1 has quit [Ping timeout: 240 seconds]
09:06
qual[away] has quit [Ping timeout: 250 seconds]
09:07
hightower2 has quit [Changing host]
09:07
hightower2 has joined #ruby
09:08
themsay has joined #ruby
09:19
ellcs1 has joined #ruby
09:20
evdubs_ has quit [Remote host closed the connection]
09:20
meinside has joined #ruby
09:21
DaRock has quit [Read error: Connection reset by peer]
09:21
evdubs_ has joined #ruby
09:22
gloscombe has joined #ruby
09:23
ellcs1 has quit [Ping timeout: 240 seconds]
09:30
keden has joined #ruby
09:33
KeyJoo has quit [Remote host closed the connection]
09:36
eightfold has joined #ruby
09:39
eightfold_ has joined #ruby
09:40
eightfold has quit [Ping timeout: 268 seconds]
09:40
eightfold_ is now known as eightfold
09:44
bjpenn has quit [Ping timeout: 252 seconds]
09:46
KeyJoo has joined #ruby
09:49
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
09:56
Qiong|HalfFull has quit [Remote host closed the connection]
09:57
neo has joined #ruby
09:57
neo has left #ruby [#ruby]
09:58
bruce_lee has joined #ruby
09:58
bruce_lee has quit [Client Quit]
09:59
bruce_lee has joined #ruby
09:59
bruce_lee has quit [Changing host]
09:59
bruce_lee has joined #ruby
10:00
claudiuinberlin has joined #ruby
10:00
DTZUZO has quit [Ping timeout: 255 seconds]
10:06
sriehl has quit [Read error: Connection reset by peer]
10:06
sriehl has joined #ruby
10:13
dinfuehr_ is now known as dinfuehr
10:14
KeyJoo has quit [Quit: KeyJoo]
10:16
claudiuinberlin has quit [Ping timeout: 240 seconds]
10:21
DTZUZO has joined #ruby
10:24
KeyJoo has joined #ruby
10:25
themsay has quit [Ping timeout: 240 seconds]
10:25
themsay has joined #ruby
10:39
ferr has joined #ruby
10:40
eightfold_ has joined #ruby
10:42
eightfold has quit [Ping timeout: 268 seconds]
10:42
eightfold_ is now known as eightfold
10:43
qual has joined #ruby
10:43
mikecmpbll has joined #ruby
11:03
eightfold has quit [Quit: eightfold]
11:14
aqd has quit [Quit: Leaving]
11:14
sinanislekdemir has joined #ruby
11:16
jane_booty_doe has joined #ruby
11:18
alem0lars has joined #ruby
11:26
conta has quit [Ping timeout: 244 seconds]
11:31
aqd has joined #ruby
11:38
beaky has quit [Read error: Connection reset by peer]
11:41
beaky has joined #ruby
11:41
ldnunes has joined #ruby
11:43
Ai9zO5AP has joined #ruby
11:44
qual is now known as qual[away]
11:47
conta has joined #ruby
11:50
alem0lars has quit [Ping timeout: 245 seconds]
11:56
alem0lars has joined #ruby
11:56
alem0lars has quit [Read error: Connection reset by peer]
11:56
eightfold has joined #ruby
11:58
keden has quit [Ping timeout: 245 seconds]
12:00
v01d4lph4 has quit [Remote host closed the connection]
12:01
keden has joined #ruby
12:02
qual[away] has quit [Quit: qual[away]]
12:08
DaRock has joined #ruby
12:13
keden has quit [Ping timeout: 255 seconds]
12:16
keden has joined #ruby
12:18
mangold has quit [Ping timeout: 252 seconds]
12:18
mangold_ has joined #ruby
12:21
v01d4lph4 has joined #ruby
12:27
<
kke >
solarized dark for everything
12:29
DTZUZO has quit [Ping timeout: 252 seconds]
12:36
v01d4lph4 has quit [Remote host closed the connection]
12:44
ray479 has joined #ruby
12:45
<
ray479 >
hello im trying regex with Ruby
12:46
ubuntuisloved has joined #ruby
12:46
<
ray479 >
is there a gem to valid email in ruby ?
12:46
<
ray479 >
i mean check valid email
12:46
za1b1tsu has joined #ruby
12:54
ray479 has quit [Quit: Page closed]
12:54
eightfold has quit [Quit: eightfold]
12:55
keden has quit [Ping timeout: 246 seconds]
12:56
keden has joined #ruby
13:09
eightfold has joined #ruby
13:10
<
ytti >
regexp is poor way to validate email, if it needs to be absolutely right
13:10
<
ytti >
you'd need proper parser with lexer and tokenizer
13:10
<
ytti >
if it needs to be just approximately right then it's not really worth a gem
13:15
ubuntuisloved has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:22
ubuntuisloved has joined #ruby
13:26
ljarvis_ has joined #ruby
13:26
ljarvis has quit []
13:26
ljarvis_ is now known as ljarvis
13:26
<
TheBrayn >
what are even usecases for 100% validating an email address?
13:27
stryek has joined #ruby
13:34
Fusl has quit [Remote host closed the connection]
13:35
fluxAeon has joined #ruby
13:35
Fusl has joined #ruby
13:39
crankharder has joined #ruby
13:39
<
ytti >
not losing customer who couldn't sign up because you wouldn't accept their email
13:39
<
ytti >
seems odd question to ask
13:40
<
ytti >
because then question rises, well, how correct must it be?
13:40
<
ytti >
i have trouble signing in with email addres from domain @0b.fi
13:40
<
ytti >
many validators expect domain not to start with number
13:40
<
ytti >
many validators expect domain to be longer than two characters
13:44
helpa has quit [Remote host closed the connection]
13:44
helpa-bot has joined #ruby
13:46
chromis has joined #ruby
13:46
jane_booty_doe has quit [Remote host closed the connection]
13:46
ljarvis_ has joined #ruby
13:46
helpa-bot has quit [Remote host closed the connection]
13:46
helpa has joined #ruby
13:47
ljarvis has quit [Ping timeout: 246 seconds]
13:47
ljarvis_ is now known as ljarvis
13:48
cyberarm_ has joined #ruby
13:48
cyberarm has quit [Ping timeout: 255 seconds]
13:49
sinanislekdemir has quit [Quit: rcirc on GNU Emacs 27.0.50]
13:53
ljarvis has quit [Ping timeout: 240 seconds]
13:56
lucasb has joined #ruby
13:58
Inline has joined #ruby
13:59
jcalla has joined #ruby
14:07
stan has joined #ruby
14:11
Swyper has joined #ruby
14:11
aupadhye has quit [Ping timeout: 245 seconds]
14:12
Swyper has quit [Remote host closed the connection]
14:14
p0s1x has joined #ruby
14:15
Swyper has joined #ruby
14:19
conta has quit [Ping timeout: 245 seconds]
14:20
p0s1x has quit [Read error: Connection reset by peer]
14:20
Fusl has quit [Ping timeout: 256 seconds]
14:21
Fusl has joined #ruby
14:33
stan has quit [Remote host closed the connection]
14:43
Rapture has joined #ruby
14:46
apparition has joined #ruby
14:48
stan has joined #ruby
14:51
stan_ has joined #ruby
14:52
mikecmpb_ has joined #ruby
14:53
stan has quit [Ping timeout: 240 seconds]
14:54
al2o3-cr has quit [Read error: Connection reset by peer]
14:54
mikecmpbll has quit [Ping timeout: 240 seconds]
14:55
polishdub has joined #ruby
14:56
al2o3-cr has joined #ruby
15:02
Nicmavr has quit [Read error: Connection reset by peer]
15:04
Nicmavr has joined #ruby
15:08
AJA4350 has joined #ruby
15:09
Swyper has quit [Remote host closed the connection]
15:10
conta has joined #ruby
15:10
gnufied has joined #ruby
15:12
Swyper has joined #ruby
15:15
conta has quit [Ping timeout: 250 seconds]
15:16
conta has joined #ruby
15:17
DaRock has quit [Ping timeout: 255 seconds]
15:17
apparition has quit [Quit: Bye]
15:21
conta has quit [Ping timeout: 252 seconds]
15:34
zleap has joined #ruby
15:34
zleap has quit [Changing host]
15:34
zleap has joined #ruby
15:45
DTZUZO has joined #ruby
15:50
v01d4lph4 has joined #ruby
15:51
t0xik has quit [Quit: Connection closed for inactivity]
15:55
eightfold has quit [Quit: eightfold]
15:58
tau has joined #ruby
16:02
AJA4351 has joined #ruby
16:04
AJA4350 has quit [Ping timeout: 252 seconds]
16:04
AJA4351 is now known as AJA4350
16:08
aufi has quit [Remote host closed the connection]
16:09
conta has joined #ruby
16:11
robotcars1 has joined #ruby
16:14
robotcars has quit [Ping timeout: 244 seconds]
16:14
conta has quit [Client Quit]
16:18
dante has quit [Read error: Connection reset by peer]
16:19
dante has joined #ruby
16:22
clemens3 has quit [Ping timeout: 252 seconds]
16:23
emilford has quit [Ping timeout: 240 seconds]
16:24
[Butch] has joined #ruby
16:25
robotcars has joined #ruby
16:26
emilford has joined #ruby
16:26
duderonomy has joined #ruby
16:28
robotcars1 has quit [Ping timeout: 250 seconds]
16:29
conta has joined #ruby
16:34
conta has quit [Ping timeout: 255 seconds]
16:35
ubuntuisloved has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:36
Swyper has quit [Remote host closed the connection]
16:37
marcoecc has joined #ruby
16:38
VladGh has joined #ruby
16:38
ubuntuisloved has joined #ruby
16:39
VladGh has quit [Remote host closed the connection]
16:40
VladGh has joined #ruby
16:43
Swyper has joined #ruby
16:43
Swyper has quit [Remote host closed the connection]
16:44
Swyper has joined #ruby
16:45
cthulchu has joined #ruby
16:47
za1b1tsu has quit [Remote host closed the connection]
16:54
mikecmpb_ has quit [Quit: inabit. zz.]
16:54
emilford has quit [Ping timeout: 240 seconds]
16:54
lxsameer has quit [Ping timeout: 268 seconds]
16:54
emilford has joined #ruby
16:54
mikecmpbll has joined #ruby
16:59
KeyJoo has quit [Ping timeout: 250 seconds]
16:59
zleap has quit [Quit: WeeChat 2.4]
17:01
ljarvis_ has joined #ruby
17:02
Swyper has quit [Remote host closed the connection]
17:03
ljarvis_ is now known as ljarvis
17:05
v01d4lph4 has quit [Remote host closed the connection]
17:05
mikecmpbll has quit [Quit: inabit. zz.]
17:06
emilford has quit [Ping timeout: 255 seconds]
17:07
emilford has joined #ruby
17:10
robotcars1 has joined #ruby
17:12
robotcars2 has joined #ruby
17:13
roychri has joined #ruby
17:14
robotcars has quit [Ping timeout: 250 seconds]
17:15
AJA4350 has quit [Ping timeout: 245 seconds]
17:15
robotcars1 has quit [Ping timeout: 245 seconds]
17:16
szulak_ has joined #ruby
17:17
roychri has left #ruby [#ruby]
17:17
marcoecc has quit [Ping timeout: 250 seconds]
17:18
sgen has joined #ruby
17:19
robotcars has joined #ruby
17:20
robotcars1 has joined #ruby
17:20
robotcars1 has quit [Client Quit]
17:20
robotcars1 has joined #ruby
17:21
robotcars2 has quit [Ping timeout: 240 seconds]
17:21
robotcars1 has quit [Client Quit]
17:23
robotcars has quit [Ping timeout: 252 seconds]
17:24
zleap has joined #ruby
17:24
zleap has quit [Changing host]
17:24
zleap has joined #ruby
17:26
jack479 has joined #ruby
17:26
<
jack479 >
Hello guys
17:28
eightfold has joined #ruby
17:29
<
jack479 >
How can i match string that can contain [a-z] [0-9] and a '-' ( provided that it is not the first or last character) ?
17:30
<
jack479 >
i tried string =~ /[a-zA-Z\-]/ ; doesn't works
17:30
<
jack479 >
anyone have an idea ?
17:30
keden has quit [Ping timeout: 250 seconds]
17:38
eightfold has quit [Quit: eightfold]
17:39
szulak_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:41
crankharder has quit [Ping timeout: 246 seconds]
17:42
amil has joined #ruby
17:42
crankharder has joined #ruby
17:43
v01d4lph4 has joined #ruby
17:46
amil has quit [Remote host closed the connection]
17:47
<
jack479 >
leftylink: oh thank you ! :)
17:48
v01d4lph4 has quit [Ping timeout: 246 seconds]
17:48
<
leftylink >
one thing to note is that the escaping you did (with a backslash) does indeed cause the hyphen to be included in the character class
17:51
robotcars has joined #ruby
17:53
<
leftylink >
if instead we focus on a different part of the question (how to express "- can't be the first or last character"), though there might be multiple ways to express this, one way that comes to mind is to say, well, the valid characters for the first/last character are the characters other than hyphen, and the valid chars for those in the middle are including hyphen
17:55
<
ljarvis >
jack479: [a-z0-9][a-z0-9-][a-z0-9] ? :)
17:56
<
ljarvis >
add a + after the second char class
17:59
jcarl43 has joined #ruby
18:05
lucasb has quit [Quit: Connection closed for inactivity]
18:10
<
leftylink >
hm. thinking about ranges has got me thinking
18:10
<
leftylink >
if you have a range that is "unusual" what happens...
18:10
<
leftylink >
&>> /[A-z]/ =~ (?A.ord + 28).chr; $~
18:10
<
ljarvis >
A-z isn't really unusual
18:10
<
leftylink >
thought it might have been something like that
18:10
zachk has joined #ruby
18:11
<
ljarvis >
well, i guess it is unusual, just not really something i'd expect to fail
18:11
<
leftylink >
hopefully anyone who uses it is okay with it matching the 6 chars in between
18:11
<
ljarvis >
i was thinking you meant a-9 or something, which would raise an error (i think)
18:12
<
leftylink >
&>> /[a-9]/
18:13
<
leftylink >
&>> (0..255).select { |c| /[9-a]/.match?(c.chr) }.minmax
18:14
eightfold has joined #ruby
18:16
snk has joined #ruby
18:18
v01d4lph4 has joined #ruby
18:19
mangold_ has quit [Quit: This computer has gone to sleep]
18:22
v01d4lph4 has quit [Ping timeout: 240 seconds]
18:28
ravenousmoose has joined #ruby
18:33
ravenousmoose has quit [Ping timeout: 258 seconds]
18:34
zachk has quit [Changing host]
18:34
zachk has joined #ruby
18:36
<
leftylink >
to be fair I didn't check that the range is continuous
18:44
bjpenn has joined #ruby
18:44
sphenxes has joined #ruby
18:47
eightfold has quit [Quit: eightfold]
18:48
gloscombe has quit [Quit: gloscombe]
18:49
aqd has quit [Remote host closed the connection]
18:50
sphenxes has quit [Remote host closed the connection]
18:51
sameerynho has joined #ruby
18:53
v01d4lph4 has joined #ruby
18:54
DTZUZO has quit [Ping timeout: 250 seconds]
18:55
[Butch] has joined #ruby
18:55
DTZUZO has joined #ruby
18:56
yqt has joined #ruby
18:57
aqd has joined #ruby
18:57
fluxAeon has quit [Ping timeout: 245 seconds]
18:58
mikecmpbll has joined #ruby
19:03
renich has joined #ruby
19:05
<
jack479 >
ok, will try on my side
19:05
<
jack479 >
get back to you guys
19:07
themsay has quit [Ping timeout: 250 seconds]
19:10
jack479 has quit [Ping timeout: 256 seconds]
19:13
zachk has quit [Ping timeout: 250 seconds]
19:19
Swyper has joined #ruby
19:21
sauvin has quit [Read error: Connection reset by peer]
19:25
millerti has joined #ruby
19:30
orbyt_ has joined #ruby
19:31
Swyper has quit [Remote host closed the connection]
19:34
Swyper has joined #ruby
19:35
orbyt_ has quit [Ping timeout: 245 seconds]
19:36
sphenxes has joined #ruby
19:39
ravenousmoose has joined #ruby
19:40
Swyper has quit [Remote host closed the connection]
19:42
orbyt_ has joined #ruby
19:43
Swyper has joined #ruby
19:45
tdy1 is now known as tdy
19:45
hightower3 has joined #ruby
19:45
hightower2 has quit [Ping timeout: 250 seconds]
19:47
naught-fowl has joined #ruby
19:47
v01d4lph4 has quit [Read error: Connection reset by peer]
19:48
v01d4lph4 has joined #ruby
19:48
dinfuehr_ has joined #ruby
19:49
dinfuehr has quit [Ping timeout: 244 seconds]
19:49
zachk has joined #ruby
19:49
zachk has quit [Changing host]
19:49
zachk has joined #ruby
19:53
v01d4lph4 has quit [Ping timeout: 240 seconds]
20:05
nwradio has joined #ruby
20:05
suukim has quit [Quit: Konversation terminated!]
20:06
Swyper has quit [Remote host closed the connection]
20:06
_mak has joined #ruby
20:07
<
nwradio >
sup my guy
20:07
<
_mak >
is there a way to convert: {"key1"=>"value1"} into {key1: "value1"}?
20:08
<
nwradio >
unfortunately i'm pretty new to ruby so i cannot help you at the moment
20:08
<
sagax >
how to right catch/throw ?
20:09
Swyper has joined #ruby
20:10
<
sagax >
i am not about begin/rescue
20:10
tau is now known as el-bigodon
20:12
Dbugger has joined #ruby
20:13
<
_mak >
what's the name of this `{key1: "value1"}?
20:13
<
_mak >
it is not json right, because on json the key is between quotes
20:14
<
snk >
that's ruby 1.9+ hash syntax
20:14
<
_mak >
but when I convert my {"key1"=>"value1"} into hash I get the same thing
20:15
arooni_team_b is now known as arooni
20:15
<
snk >
pre 1.9 hash syntax is still valid
20:16
<
snk >
the latter example there is slightly different, in that the key will be a symbol instead of a string
20:16
<
_mak >
in it possible to convert it?
20:17
<
naught-fowl >
Hash[ somehash.map {|k,v| [k.to_sym, v]} ]
20:17
<
_mak >
with your 'symbol' keyword
20:17
<
_mak >
hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
20:17
<
_mak >
nice thanks!
20:18
sphenxes has quit [Quit: Leaving]
20:18
<
snk >
rubocop can do it... though i'd be careful in any places where you rely on the key being a string?
20:19
<
_mak >
didn't work :(
20:19
<
_mak >
not all levels of the hash have been converted into symbols
20:25
yqt has quit [Ping timeout: 240 seconds]
20:34
zleap has quit [Quit: WeeChat 2.4]
20:35
go|dfish has quit [Ping timeout: 246 seconds]
20:35
<
naught-fowl >
right
20:39
AJA4350 has joined #ruby
20:43
nowhereman has joined #ruby
20:43
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:46
Swyper has quit [Remote host closed the connection]
20:48
nowhereman has quit [Ping timeout: 245 seconds]
20:48
go|dfish has joined #ruby
20:54
hiroaki_ has quit [Ping timeout: 255 seconds]
20:55
n13z has joined #ruby
20:57
Swyper has joined #ruby
20:59
szulak_ has joined #ruby
21:01
SeepingN has joined #ruby
21:10
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
21:13
gix has joined #ruby
21:15
ldnunes has quit [Quit: Leaving]
21:19
Fernando-Basso has joined #ruby
21:24
tiogrand_ has joined #ruby
21:27
naught-fowl has quit [Quit: This computer has gone to sleep]
21:30
ua has quit [Ping timeout: 255 seconds]
21:30
noobineer has quit [Ping timeout: 245 seconds]
21:35
FastJack has quit [Ping timeout: 264 seconds]
21:41
naught-fowl has joined #ruby
21:42
FastJack has joined #ruby
21:43
ua has joined #ruby
21:43
BTRE has quit [Remote host closed the connection]
21:48
AJA4350 has quit [Ping timeout: 245 seconds]
21:50
noobineer has joined #ruby
21:53
BTRE has joined #ruby
22:00
<
mkroman >
what's an efficient way to generate a sha256 digest for a file in Ruby?
22:00
<
mkroman >
any gems?
22:00
<
havenwood >
mkroman: it's in the stdlib under Digest
22:01
<
mkroman >
for files?
22:01
<
havenwood >
for anything
22:01
<
mkroman >
unless the API lets me do it directly from IO it's gonna be slow as balls in Ruby
22:02
dviola has joined #ruby
22:04
<
havenwood >
&ri Digest::SHA256.file
22:04
<
rubydoc >
parser error at position 0 around `r'
22:05
<
havenwood >
&ri Digest::SHA256::file
22:05
<
rubydoc >
parser error at position 0 around `r'
22:05
<
havenwood >
mkroman: anyhow, you can use Digest::SHA2 with IO
22:06
dellavg__ has quit [Ping timeout: 245 seconds]
22:07
<
mkroman >
damnit, so I can…
22:07
<
mkroman >
thanks! and sorry for bothering you, kinda should've looked it up myself :p
22:07
redmedic has joined #ruby
22:08
<
redmedic >
cross posting from the #cinch channel but its pretty inactive. Im using cinch to try and make an irc bot that can use memoserv and Im not seeing anything in the gem to interact with it.
22:10
<
mkroman >
memoserv should just be a reserved user on the network that you talk to, any commands you want to send to it you can do through privmsg's
22:10
ravenousmoose has quit [Ping timeout: 264 seconds]
22:11
tiogrand_ has quit [Ping timeout: 250 seconds]
22:12
<
sagax >
but i don't understand - right way to use throw/catch
22:13
hightower3 has quit [Changing host]
22:13
hightower3 has joined #ruby
22:13
<
sagax >
catch :foo do throw :foo end - it's strange
22:15
Dbugger has quit [Ping timeout: 240 seconds]
22:16
<
mkroman >
(and yes, I know it depends heavily on the system cache and the fact that it's on a tmpfs, but there's still a significant difference)
22:17
<
mkroman >
and the overhead might be entirely in the process spawning
22:17
AJA4350 has joined #ruby
22:19
<
mkroman >
sagax: are you asking as a beginner or are you looking to optimize code?
22:19
Swyper has quit [Remote host closed the connection]
22:20
<
sagax >
i want understand catch/throw
22:21
<
baweaver >
sagax: Use begin / rescue
22:21
<
mkroman >
honestly, I've never seen catch/throw used in real life
22:22
<
sagax >
i need catch/throw
22:22
<
leftylink >
I forgot catch / throw exists
22:22
naught-fowl has quit [Quit: This computer has gone to sleep]
22:24
<
mkroman >
sagax: from what I gather the difference is that catch/throw won't have
*any* stack information, backtrace log, error type or message
22:24
<
ytti >
afaik it is 'goto'
22:25
<
ytti >
i have no idea of what the application might be
22:25
<
ytti >
i suspect more idiomatic solution exists to most or all problems
22:25
<
mkroman >
whereas rescue/raise will create a whole object, reverse the stack and store the backtrace in it just to give you more information
22:27
<
mkroman >
if you need exceptions to be performant, you're doing something wrong.
22:27
<
sagax >
catch/throw can return result
22:27
<
leftylink >
that is interesting.
22:27
<
sagax >
and catch/throw can stop block
22:27
<
sagax >
without exception
22:27
<
sagax >
stop and return something
22:31
<
leftylink >
&>> catch(:hello) { 1.step { |n| throw :hello, n if Math.log(Math.log(n)) >= Math::E } }
22:31
<
leftylink >
so, I could do that, if I felt like
22:31
<
leftylink >
but I wuld rather use 1.step.find in this instance
22:31
<
baweaver >
sagax: Use begin / rescue, you'll have a lot easier time.
22:32
<
leftylink >
or I would use a function and return frmo it maybe?
22:32
<
baweaver >
What code do you
_need_ it for?
22:32
<
baweaver >
begin / rescue can also return a result.
22:33
<
sagax >
begin/rescue it's about exceptions,
22:33
<
baweaver >
Very often when one thinks they
_need_ a language feature that's not entirely accurate. It depends heavily on context, and sometimes we're bent on shoehorning our problem to match.
22:33
<
sagax >
but i don't need it
22:33
<
baweaver >
What problem are you trying to solve?
22:33
<
baweaver >
because it sounds a lot like `break` or `next`
22:34
<
sagax >
i need just stop function and return something
22:34
<
baweaver >
You're fixating on try/catch, not your actual problem.
22:34
<
sagax >
all this can do catch/throw
22:34
<
baweaver >
Do you have a code example?
22:34
<
baweaver >
You can use `return` for that as well.
22:34
<
leftylink >
if you want to stop a function and return something, then it sounds like you want `return`, not try/catch
22:34
<
leftylink >
... beaten to the punch
22:34
<
sagax >
no, return it's ugle
22:34
<
sagax >
it's like as switch/case
22:35
<
sagax >
or if/else/if/else/if/else
22:35
reber has quit [Remote host closed the connection]
22:35
<
baweaver >
What if we said that try/catch is ugly?
22:35
schleppel has quit [Quit: Konversation terminated!]
22:35
<
sagax >
ok, i show,
22:35
<
baweaver >
If you're bent on using it, use it.
22:44
mochiyoda has joined #ruby
22:47
SuperL4g has joined #ruby
22:50
AJA4351 has joined #ruby
22:50
SuperLag has quit [Ping timeout: 245 seconds]
22:53
polishdub has quit [Remote host closed the connection]
22:53
AJA4350 has quit [Ping timeout: 240 seconds]
22:53
AJA4351 is now known as AJA4350
22:54
<
mkroman >
sagax: if your code is proliferated with if else if else, you might want to use if guards
23:01
nowhereman has joined #ruby
23:01
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
23:07
<
sagax >
it's simple examples
23:08
<
baweaver >
Yeah, just use `return`.
23:08
<
sagax >
if i use return i need if/else/if/else/if/else
23:09
<
sagax >
throw i can call in any place
23:09
<
baweaver >
You're not gaining any clarity there.
23:09
<
baweaver >
If anything you're trying to ad-hoc on pattern matching
23:09
<
sagax >
return "something" if some - it's not what i need
23:10
<
baweaver >
It's an approximation of an Either type.
23:10
<
baweaver >
You're using throw/catch as a psuedo-either type to pass additional context with returns
23:10
<
sagax >
i use throw to stop function
23:11
<
baweaver >
I'm not really sure what you want here.
23:11
<
baweaver >
You're fixated on one solution, so just use it.
23:11
<
baweaver >
Just be warned it's not very common and will likely confuse other programmers.
23:16
Swyper has joined #ruby
23:18
<
phaul >
ah. 256 is not allowed in class namesin my parser. sorry havenwood I fix it
23:19
<
phaul >
&ri Digest::SHA
23:19
<
rubydoc >
Found no entry that matches class Digest::SHA
23:19
<
phaul >
&ri Digest::SHA256
23:19
<
rubydoc >
parser error at position 0 around `r'
23:21
<
phaul >
ruby syntax rules are super complex :)
23:23
Swyper has quit [Remote host closed the connection]
23:25
Autolycus has joined #ruby
23:25
gigetoo has quit [Ping timeout: 245 seconds]
23:28
gigetoo has joined #ruby
23:29
Swyper has joined #ruby
23:33
rafadc has joined #ruby
23:35
tdy1 has joined #ruby
23:36
tdy has quit [Ping timeout: 244 seconds]
23:47
Swyper has quit [Remote host closed the connection]
23:54
cnsvc has joined #ruby
23:59
AJA4351 has joined #ruby
23:59
uplime is now known as darth_uplime