havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
PCiobanita has quit [Ping timeout: 256 seconds]
AJA4350 has joined #ruby
Puffball has quit [Remote host closed the connection]
davidw has quit [Ping timeout: 272 seconds]
tdy2 has joined #ruby
tdy2 has quit [Ping timeout: 252 seconds]
mspo has left #ruby [#ruby]
catbusters has joined #ruby
profetes_ has quit [Quit: Leaving]
tdy2 has joined #ruby
sarink has joined #ruby
tdy2 has quit [Ping timeout: 252 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
hanmac has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
houhoulis has quit [Remote host closed the connection]
m27frogy has quit [Quit: ZNC - https://znc.in]
sarink has quit [Remote host closed the connection]
m27frogy has joined #ruby
orbyt_ has joined #ruby
hanmac has quit [Ping timeout: 245 seconds]
Rich_Morin_ has joined #ruby
hutch has joined #ruby
esrse has joined #ruby
houhoulis has joined #ruby
uplime has joined #ruby
mostlybadfly has joined #ruby
tdy2 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
themsay has joined #ruby
dbugger_ has joined #ruby
hutch has quit [Ping timeout: 258 seconds]
Dbugger has quit [Ping timeout: 264 seconds]
sarink has joined #ruby
hutch has joined #ruby
tdy2 has quit [Ping timeout: 250 seconds]
tdy2 has joined #ruby
sarink has quit [Remote host closed the connection]
catbusters has quit [Quit: Connection closed for inactivity]
sarink has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
uplime has quit [Quit: WeeChat 2.2]
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
sarink has quit [Remote host closed the connection]
Rich_Morin_ has joined #ruby
sarink has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
sarink has quit [Remote host closed the connection]
Rich_Morin_ has quit [Client Quit]
sarink has joined #ruby
hutch has quit [Ping timeout: 245 seconds]
hutch has joined #ruby
Rich_Morin_ has joined #ruby
TheNet is now known as Net
Net is now known as TheNet
TheNet is now known as Net
Net has quit []
Net has joined #ruby
<Net> whois net net
hutch has quit [Ping timeout: 272 seconds]
tdy2 has quit [Ping timeout: 268 seconds]
orbyt_ has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
hutch has joined #ruby
Swyper has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
brandonkal has quit [Quit: Textual IRC Client: www.textualapp.com]
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
sauvin_ has joined #ruby
sauvin has quit [Ping timeout: 272 seconds]
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
houhoulis has quit [Remote host closed the connection]
Rich_Morin_ has joined #ruby
dellavg_ has joined #ruby
porg has joined #ruby
davidw has joined #ruby
Rich_Morin_ has quit [Client Quit]
evdubs_ has joined #ruby
evdubs has quit [Ping timeout: 250 seconds]
sauvin_ is now known as Sauvin
tdy2 has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #ruby
uplime has joined #ruby
davidw has quit [Ping timeout: 246 seconds]
idiocrash has joined #ruby
saltsa has quit [Quit: leaving]
mikecmpbll has quit [Quit: inabit. zz.]
dellavg_ has quit [Ping timeout: 246 seconds]
\void has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
tdy2 has quit [Ping timeout: 272 seconds]
SuperLag has quit [Remote host closed the connection]
SuperLag has joined #ruby
conta has joined #ruby
Inline has quit [Quit: Leaving]
idiocrash has quit [Read error: Connection reset by peer]
idiocrash has joined #ruby
tdy2 has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
aufi has joined #ruby
aupadhye has joined #ruby
porg has quit [Ping timeout: 268 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
ziyadb has joined #ruby
cthulchu has quit [Ping timeout: 240 seconds]
cthulchu has joined #ruby
gix has joined #ruby
drale2k_ has joined #ruby
gix has quit [Ping timeout: 246 seconds]
am0123 has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dminuoso has joined #ruby
tdy2 has quit [Ping timeout: 245 seconds]
dminuoso has left #ruby ["WeeChat 2.0.1"]
CrazyEddy has quit [Remote host closed the connection]
SqREL has joined #ruby
SqREL has quit [Remote host closed the connection]
SqREL has joined #ruby
clemens3 has joined #ruby
vondruch has quit [Quit: vondruch]
SqREL has quit [Ping timeout: 258 seconds]
status402 has joined #ruby
kapil____ has joined #ruby
mikecmpbll has joined #ruby
themsay has quit [Ping timeout: 246 seconds]
apparition has joined #ruby
SqREL has joined #ruby
vondruch has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
ellcs has joined #ruby
idiocras_ has joined #ruby
aupadhye has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
idiocrash has quit [Ping timeout: 258 seconds]
aupadhye has joined #ruby
SqREL has quit [Remote host closed the connection]
tdy2 has joined #ruby
queip has quit [Ping timeout: 268 seconds]
paranoicsan has joined #ruby
themsay has joined #ruby
mat_bug has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
mat_bug has quit [Remote host closed the connection]
sarink has quit [Ping timeout: 250 seconds]
ur5us has joined #ruby
idiocras_ has quit [Quit: Textual IRC Client: www.textualapp.com]
queip has joined #ruby
uplime has quit [Ping timeout: 258 seconds]
paranoicsan has quit [Quit: paranoicsan]
za1b1tsu has joined #ruby
queip has quit [Ping timeout: 250 seconds]
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
queip has joined #ruby
alexterziev has joined #ruby
paranoicsan has joined #ruby
tdy2 has quit [Ping timeout: 272 seconds]
ur5us has quit [Remote host closed the connection]
profetes has joined #ruby
dhollin3 has joined #ruby
uplime has joined #ruby
dhollinger has quit [Ping timeout: 252 seconds]
status402 has quit [Read error: Connection reset by peer]
status402 has joined #ruby
alexterziev has quit [Ping timeout: 256 seconds]
x0f has quit [Ping timeout: 272 seconds]
gigetoo has quit [Ping timeout: 258 seconds]
gigetoo has joined #ruby
x0f has joined #ruby
uplime has quit [Ping timeout: 245 seconds]
Sauvin has quit [Ping timeout: 246 seconds]
x0f_ has joined #ruby
x0f has quit [Ping timeout: 250 seconds]
Sauvin has joined #ruby
sauvin_ has joined #ruby
Sauvin has quit [Ping timeout: 245 seconds]
brandonkal has joined #ruby
sauvin_ is now known as Sauvin
gregf_ has joined #ruby
rikkipitt has joined #ruby
soyeomul^bionic has joined #ruby
<soyeomul^bionic> i would like to run with linux shell commands such as grep awk sed xargs
<soyeomul^bionic> is that possible with ruby?
<phaul> you can run shell commands like `ls -a`
<phaul> &ri Kernel#`
<soyeomul^bionic> wow that is easy more than python.
<soyeomul^bionic> ruby good!!!
AJA4350 has joined #ruby
<soyeomul^bionic> question.
<soyeomul^bionic> by the way, what is different `` and exec?
<phaul> exec replaces the current process with the one you point to. it's a lower level primitive. To implement `` you need exec but you also need fork, and capturing the child processs output. `` does a lot more
<phaul> &ri exec
<rubydoc> I found 2 entries matching method exec. Use &list exec if you would like to see a list
<phaul> &ri Kernel#exec
esrse has quit [Quit: 굿나잇]
paranoicsan is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
<soyeomul^bionic> thanks phaul, you kind man. i take myself study that
<phaul> yw
noboruma has quit [Quit: leaving]
<soyeomul^bionic> ruby doc is so cool!!!
paranoicsan has joined #ruby
mostlybadfly has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
rikkipitt has quit [Quit: Leaving...]
nowhere_man has quit [Ping timeout: 244 seconds]
uplime has joined #ruby
gregf_ has quit [Ping timeout: 256 seconds]
am0123 has quit [Ping timeout: 245 seconds]
HCW has joined #ruby
HCW has left #ruby ["Closing Window"]
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
catphish has joined #ruby
<catphish> does ruby have a while loop with no block?
<canton7> catphish, can you give an example of its usage?
<canton7> what would the point of a while loop which does nothing be?
<catphish> def process_one; something_that_returns_true_or_false; end; while(process_one);
nowhere_man has joined #ruby
<catphish> i've been writing C for a couple of weeks and i'm in the habit of writing: while(something_that_processes_and_tests);
<catphish> the use base being to have one method that processes something once, and a separate method that runs it repeatedly, but allows the loop to be broken
<catphish> canton7: so the loop doesn't do nothing, it's just that the work is done as part of the test
uplime has quit [Ping timeout: 252 seconds]
<canton7> ah, gotcha. I think you'll have to write it the same way as in C, with an empty block
<catphish> i suppose in C it's just an empty statement (the semi-colon at the end is actually a complete statement hat does nothing)
<catphish> this is ok, just not that pretty: while process_once; end
<canton7> 'while (process_once) { }' ?
jottr has joined #ruby
<catphish> canton7: i think "while" implies "begin"
<canton7> duh yes
<phaul> while in ruby is a keyword not a method. and it has a body not a block
<canton7> yeah, I wasn't thinking
<phaul> loop on the other hand is a method.
<catphish> phaul: makes sense
Dreamer3_ has quit [Quit: Leaving...]
<catphish> i didn't know that, explains why it's loop *do*
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 258 seconds]
vondruch_ is now known as vondruch
apparition has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jcalla has quit [Ping timeout: 268 seconds]
gregf_ has joined #ruby
uplime has joined #ruby
aupadhye has quit [Ping timeout: 258 seconds]
CrazyEddy has joined #ruby
soyeomul^bionic has quit [Quit: ERC (IRC client for Emacs 26.1)]
<leftylink> uh I guess if you wanted to golf it you can use postfix while on _
<leftylink> so like
<leftylink> &>> a=0; f=->{a+1>3}; _ while f[]; p :hello
<rubydoc> # => :hello ...check link for more (https://carc.in/#/r/5zw3)
nowhere_man has quit [Ping timeout: 252 seconds]
* phaul confused
<phaul> i expected undefined local variable or method _
dinfuehr has quit [Ping timeout: 246 seconds]
<leftylink> oops, can you not do that in a script... uh, maybe something silly like `0 while f[]` then
<phaul> or _=_ :)
<leftylink> that's a "correct! nil! wat" moment
dinfuehr has joined #ruby
<phaul> &>> a=0; f=->{a+1<3}; _ while f[]; p :hello
<rubydoc> # => undefined local variable or method `_' for main:Object (NameError) (https://carc.in/#/r/5zw6)
<leftylink> I also meant a+=1
<leftylink> should have printed out more things to verify that things were actually working
<leftylink> facepalm
<leftylink> and that needs parens too, that's great
<leftylink> the += I mean
<leftylink> yeah so I guess it'd be something like
<leftylink> &>> a = []; i = 0; f = ->{ a << i; (i += 1) < 3}; p while f[]; a
<rubydoc> # => [0, 1, 2] (https://carc.in/#/r/5zw7)
_whitelogger has joined #ruby
apparition has joined #ruby
uplime has quit [Ping timeout: 240 seconds]
apparition has quit [Client Quit]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
uplime has joined #ruby
chromis has joined #ruby
chromis has left #ruby [#ruby]
jcalla has joined #ruby
konos5 has joined #ruby
cow[moo] has joined #ruby
krawchyk has joined #ruby
uplime has quit [Ping timeout: 258 seconds]
Inline has joined #ruby
uplime has joined #ruby
xrexeon has joined #ruby
uplime has quit [Ping timeout: 252 seconds]
Rapture has joined #ruby
cow[moo] has quit [Read error: Connection reset by peer]
cow[moo] has joined #ruby
twobitsprite has joined #ruby
rippa has joined #ruby
madhatter has quit [Remote host closed the connection]
madhatter has joined #ruby
polishdub has joined #ruby
status402 has quit [Quit: status402]
status402 has joined #ruby
conta has quit [Ping timeout: 258 seconds]
chouhoulis has joined #ruby
hutch has joined #ruby
status402 has quit [Read error: Connection reset by peer]
status402 has joined #ruby
chouhoulis has quit [Remote host closed the connection]
dhollin3 is now known as dhollinger
_axx has left #ruby ["I Must Go, My Planet Needs Me"]
status402 has quit [Quit: status402]
bmurt has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 245 seconds]
catbusters has joined #ruby
paranoicsan is now known as paranoicsan[Away
paranoicsan[Away has quit [Quit: paranoicsan[Away]
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
elcontrastador has joined #ruby
davidw has joined #ruby
ams__ has joined #ruby
uplime has joined #ruby
\void has joined #ruby
sylario has joined #ruby
sputnik13 has joined #ruby
profetes has quit [Quit: Leaving]
aufi has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 246 seconds]
bak1an has joined #ruby
orbyt_ has joined #ruby
paranoicsan[Away has joined #ruby
orbyt_ has quit [Client Quit]
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
planigan has quit [Ping timeout: 258 seconds]
planigan has joined #ruby
bmurt has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
johnny56 has quit [Read error: Connection reset by peer]
konos5 has quit [Quit: Connection closed for inactivity]
NL3limin4t0r_afk is now known as NL3limin4t0r
hutch has quit [Ping timeout: 258 seconds]
am0123 has joined #ruby
paranoicsan[Away has quit [Quit: paranoicsan[Away]
conta has joined #ruby
catphish has quit [Quit: Leaving]
Nicmavr has quit [Read error: Connection reset by peer]
johnny56 has joined #ruby
paranoicsan has joined #ruby
Nicmavr has joined #ruby
<za1b1tsu> I dont understand why would "gogo".match /\w/ # => #<MatchData "g">
<uplime> why it only matched one character?
<za1b1tsu> uplime, yes
<uplime> from the docs: /\w/ - A word character ([a-zA-Z0-9_])
<havenwood> za1b1tsu: Compare with: /\w*/
<za1b1tsu> ah so the equivalent of most regex engines will be /\w+/
donofrio has joined #ruby
cthulchu_ has quit [Quit: Leaving]
cthulchu_ has joined #ruby
<phaul> echo gogo | sed s/./x/ # => xogo
<phaul> sed works the same way
irightcode2 has joined #ruby
<irightcode2> can I ask bundler/rake questions here?
hutch has joined #ruby
<phaul> ask away
<phaul> I mean sure. go for it :)
<irightcode2> I would like import bundle task from another gem, is this possible
<irightcode2> rake task. i mean
orbyt_ has joined #ruby
conta2 has joined #ruby
<irightcode2> a little more information on the question: https://dpaste.de/tcS6
raulp has joined #ruby
conta2 has quit [Ping timeout: 244 seconds]
fiachetti has joined #ruby
clemens3 has quit [Ping timeout: 258 seconds]
paranoicsan has quit [Quit: paranoicsan]
za1b1tsu has quit [Ping timeout: 250 seconds]
sanscoeur has joined #ruby
Sauvin has quit [Remote host closed the connection]
bak1an has quit [Ping timeout: 246 seconds]
r29v has joined #ruby
f3ttX] has joined #ruby
reber has joined #ruby
reber has quit [Remote host closed the connection]
grvgr has joined #ruby
<irightcode2> How do you import rake tasks from another Rakefile?
r29v has quit [Quit: r29v]
lxsameer has joined #ruby
NL3limin4t0r is now known as NL3limin4t0r_afk
Swyper has joined #ruby
sarink has joined #ruby
Swyper has quit [Ping timeout: 258 seconds]
conta has quit [Quit: conta]
ams__ has quit [Quit: Connection closed for inactivity]
am0123 has quit [Ping timeout: 246 seconds]
irightcode2 has quit [Ping timeout: 256 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
[Butch] has joined #ruby
vikaton has joined #ruby
themsay has quit [Ping timeout: 258 seconds]
mikecmpbll has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reber has joined #ruby
orbyt_ has joined #ruby
SeepingN has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
lytol_ has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
f3ttX] has quit [Quit: Lost terminal]
am0123 has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 258 seconds]
connermcd has joined #ruby
polishdub has quit [Quit: leaving]
paraxial has joined #ruby
nickjj has quit [Read error: Connection reset by peer]
nickjj has joined #ruby
r29v has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
catbusters has quit [Quit: Connection closed for inactivity]
<miah> not sure about a Rakefile, but if the other gem provides a library its not hard, eg; https://github.com/test-kitchen/test-kitchen/blob/master/lib/kitchen/rake_tasks.rb
cd has joined #ruby
gix has joined #ruby
reber has quit [Remote host closed the connection]
am0123 has quit [Ping timeout: 258 seconds]
orbyt_ has quit [Ping timeout: 258 seconds]
AJA4350 has joined #ruby
ur5us has joined #ruby
connermcd has quit [Quit: WeeChat 2.3]
profetes has joined #ruby
connermcd has joined #ruby
nowhere_man has joined #ruby
sanscoeu_ has joined #ruby
themsay has joined #ruby
evdubs__ has joined #ruby
Dbugger has joined #ruby
sanscoeur has quit [Ping timeout: 240 seconds]
Iambchop_ has joined #ruby
timeless_ has joined #ruby
teej_ has joined #ruby
timeless has quit [Disconnected by services]
tdy3 has joined #ruby
quintasan has joined #ruby
beaky1 has joined #ruby
timeless_ is now known as timeless
nowhere_man has quit [Ping timeout: 252 seconds]
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
creat has quit [Ping timeout: 268 seconds]
michael_mbp has quit [Ping timeout: 268 seconds]
teej has quit [Ping timeout: 268 seconds]
Iambchop has quit [Ping timeout: 268 seconds]
vqrs has quit [Ping timeout: 268 seconds]
evdubs_ has quit [Ping timeout: 268 seconds]
dbugger_ has quit [Ping timeout: 268 seconds]
beaky has quit [Ping timeout: 268 seconds]
Cybergeek has quit [Ping timeout: 268 seconds]
twe4ked has quit [Ping timeout: 268 seconds]
Iambchop_ is now known as Iambchop
teej_ is now known as teej
vqrs_ has joined #ruby
twe4ked has joined #ruby
cpallares has quit [Ping timeout: 246 seconds]
creat has joined #ruby
d^sh has quit [Ping timeout: 246 seconds]
ghormoon has quit [Ping timeout: 246 seconds]
themsay has quit [Ping timeout: 268 seconds]
themsay has joined #ruby
michael_mbp has joined #ruby
d^sh has joined #ruby
cpallares has joined #ruby
sanscoeu_ has quit [Remote host closed the connection]
tdy3 has quit [Ping timeout: 250 seconds]
sanscoeur has joined #ruby
ghormoon has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
am0123 has joined #ruby
connermcd has quit [Quit: WeeChat 2.3]
themsay has quit [Ping timeout: 250 seconds]
zapata has quit [Ping timeout: 252 seconds]
zapata has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
hutch has quit [Ping timeout: 258 seconds]
r29v has quit [Quit: r29v]
hutch has joined #ruby
sanscoeur has quit [Remote host closed the connection]
uplime has quit [Remote host closed the connection]
dviola has joined #ruby
nowhere_man has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy3 has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
muhairwe has joined #ruby
r29v has joined #ruby
xrexeon has quit [Remote host closed the connection]
sanscoeur has joined #ruby
muhairwe has quit []
orbyt_ has joined #ruby
uplime has joined #ruby
chouhoulis has joined #ruby
G has quit [Remote host closed the connection]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
tiff has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
ziyadb has quit [Quit: Connection closed for inactivity]
am0123 has quit [Ping timeout: 250 seconds]
cybergeeek has joined #ruby
jabowa has joined #ruby
Nirvash has joined #ruby
ModusPwnens has joined #ruby
<ModusPwnens> I think i'm trying to do something strange with ruby. Is it valid to do nested inline rescue statements?
<ModusPwnens> Code example here: https://pastebin.com/TCJkDC9m
<ruby[bot]> ModusPwnens: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<Nirvash> Is there a way to call a method in Ruby like so: (Class.new)->method ?
<jabowa> Hey there, is there a method to convert date to the following format? https://repl.it/repls/OnlyCorruptHertz
<ModusPwnens> OK, here is the gist instead of pastebin: https://gist.github.com/djdawson3/2ad3ce234cbf41e0dbe8bd620c7bae0d
<ModusPwnens> Seems like you can only do one level of nested inline rescues?
<Nirvash> ModusPwnens — Is there a reason to use the rescues in that example?
<leftylink> more parens are needed
<ModusPwnens> i mean, no because it's contrived to be an example.
<ModusPwnens> oh wow, it was really just the parens.
mikecmpbll has joined #ruby
<leftylink> I had not thought to do that until it was just brought up, but it is interesting
<ModusPwnens> i hadn't thought to either. normally ruby is pretty smart about order of operations but i guess this time it needs help
<ModusPwnens> so does that mean the second rescue is just... not doing anything?
<al2o3-cr> jabowa: DateTime.parse('Mon, 14 Jan 2019 14:59:00 -0500').iso8601
<leftylink> okay so I played around with where the parens should go, this is interesting
<uplime> Nirvash: what would that syntax do?
<uplime> (Class.new)->method i mean
<leftylink> &>> ruby -e 'def rawr(num); raise "no" if num.even?; num end; test = rawr(2) rescue rawr(4) rescue rawr(5); test
<rubydoc> # => (https://carc.in/#/r/600i)
<Nirvash> In other languages it would call that method
<leftylink> &>> ruby -e 'def rawr(num); raise "no" if num.even?; num end; test = (rawr(2) rescue rawr(4)) rescue rawr(5); test
<rubydoc> # => (https://carc.in/#/r/600j)
<havenwood> ModusPwnens: Consider using an ArgumentError and interpolating: raise ArgumentError, "expected odd number but `#{num}' is even" if num.even?
<Nirvash> Is there a way to do that in Ruby without assigning the new class to a variable first?
hutch has quit [Ping timeout: 246 seconds]
<uplime> Nirvash: Wouldn't that just be Class.new.method in ruby then?
<leftylink> &>> ruby -e 'def rawr(num); raise "no" if num.even?; num end; test = rawr(2) rescue (rawr(4) rescue rawr(5)); test
<rubydoc> # => (https://carc.in/#/r/600m)
<uplime> &>> Array.new.size
<rubydoc> # => 0 (https://carc.in/#/r/600n)
twobitsprite has quit [Ping timeout: 245 seconds]
<Nirvash> In Ruby it would be two steps: a = Class.new a.method
<Nirvash> I was hoping there was something like (Class.new)->method to condense it
<ModusPwnens> leftylink: looks like you have to do test = (rawr(2) rescue rawr(4)) rescue rawr(5)
<al2o3-cr> Class.new.method ?
<uplime> Nirvash: https://clbin.com/AgnlR
<Nirvash> If that's possible, that would be perfect
<havenwood> Nirvash: you can chain methods of ^
<ModusPwnens> havenwood: this is a contrived example. my real code does something a bit different but still throws an exception with raise "..."
<Nirvash> Perfect! Thank you
<havenwood> ModusPwnens: Interpolation saves a String allocation, spares an explicit #to_s call, and avoids needing parens.
<ModusPwnens> havenwood: I tried using string interpolation and the issue with the nested rescues remains
hutch has joined #ruby
<al2o3-cr> leftylink: why are you using ruby -e?
<leftylink> oh no, that would be why
<leftylink> I pasted too much
<leftylink> no wonder that was all messed up
<al2o3-cr> ;)
<havenwood> ModusPwnens: gotcha - yeah the nested rescues remind me of a Ruby obfuscation submission: https://github.com/tric/trick2018/blob/master/01-kinaba/entry.rb
<havenwood> no-op program ^
<ModusPwnens> i'm not sure I follow :(. What do you mean by ruby obfuscation submission?
<ModusPwnens> oh i see. that's clever.
<leftylink> a submission to a ruby obfuscation contest
<havenwood> 1st (Gold): "Most reserved" -- kinaba
<havenwood> I guess it's transcendental imbroglio, not obfuscation ¯\_(ツ)_/¯
<al2o3-cr> yusuke endoh is a god!
tdy3 is now known as tdy
<al2o3-cr> that quine with about god knows how many languages. just WOW!
<phaul> booring.. then it took an interesting turn :)
<leftylink> okay, now I'm ready
<leftylink> &>> def f(num); raise "no" if num.even?; num end; t1 = f(2) rescue f(4) rescue f(5); t2 = f2 rescue (f(4) rescue f(5)); t3 = (f(2) rescue f(4)) rescue f(5); (t4 = f(2) rescue f(4)) rescue f(5); p [t1, t2, t3, t4]
<rubydoc> # => [nil, 5, 5, nil] ...check link for more (https://carc.in/#/r/600r)
eddof13 has joined #ruby
<leftylink> so I'm forced to assume that t1 is parsed like t4
<uplime> havenwood: wow thats trippy
<leftylink> maybe there are some other possible parses that result in the same
* phaul wanted to make that ^ pun last time it was on, but missed my chance
nfk has joined #ruby
eddof13 has quit [Ping timeout: 268 seconds]
<ModusPwnens> i'm moderately proficient in ruby but that seems a bit unexpected/unintuitive
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> oh, al2o3-cr I was afk, when you asked. yes rubydoc has parslet
<nfk> ModusPwnens, and the standard answer is that it's supposed to be intuitive to matz
<nfk> been there, asked that
<nfk> or rather, been here; asked that
<al2o3-cr> phaul: yeah, i was just be nosey looking through your repo for rubydoc ;)
orbyt_ has joined #ruby
tdy has quit [Ping timeout: 268 seconds]
<nfk> are there good orm's for a single file script to access a basic db - sqlite would be neat but i can probably live with something much simpler
<havenwood> nfk: The Sequel gem is lovely
hutch has quit [Ping timeout: 272 seconds]
<nfk> havenwood, neat, looking at the example, looks pretty much what I had in mind. thanks
<nfk> +like
<leftylink> &ast>> t1 = f(2) rescue f(4) rescue f(5)
<rubydoc> I have parsed your code, the result is at https://carc.in/#/r/600s
r29v has quit [Quit: r29v]
<leftylink> that is indeed an interesting parse
al2o3-cr has quit [Quit: WeeChat 2.3]
<nfk> wait, a rescue on function? is that legit?
ellcs has joined #ruby
al2o3-cr has joined #ruby
beaky1 has quit [Quit: WeebChat 2.0.1]
<leftylink> I would think it's equally valid (or not) as an other use of modifier-rescue
<leftylink> I do wonder about why one bound tighter than the = and the other didn't though
beaky has joined #ruby
jabowa has quit [Quit: Page closed]