havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.7.0-preview1: 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!
gix has quit [Ping timeout: 272 seconds]
involans has joined #ruby
queip has joined #ruby
skryking_ has joined #ruby
skryking has quit [Ping timeout: 245 seconds]
envex has joined #ruby
jcalla has quit [Ping timeout: 276 seconds]
psilly0 has quit [Ping timeout: 245 seconds]
lepepe has joined #ruby
lepepe_ has joined #ruby
Dr_MDMA_MD has quit []
lepepe has quit [Ping timeout: 268 seconds]
<adam12> Nice
involans has quit [Quit: involans]
Dr_MDMA_MD has joined #ruby
involans has joined #ruby
cornfeedhobo has quit [Ping timeout: 245 seconds]
xco has joined #ruby
stan has quit [Ping timeout: 245 seconds]
Fernando-Basso has quit [Remote host closed the connection]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 272 seconds]
AJA4351 is now known as AJA4350
Thenekofell has quit [Ping timeout: 245 seconds]
RyanMcCoskrie has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 272 seconds]
skryking_ has quit [Quit: Leaving]
cornfeedhobo has joined #ruby
xco has quit [Quit: xco]
involans has quit [Quit: involans]
involans has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 248 seconds]
davor_ is now known as davor
Thenekofell has joined #ruby
colechristensen has joined #ruby
colechristensen has quit [Read error: Connection reset by peer]
colechr60 has quit [Ping timeout: 246 seconds]
xco has joined #ruby
AJA4350 has quit [Quit: AJA4350]
colechristensen has joined #ruby
caduguedess has quit [Ping timeout: 245 seconds]
Thenekofell has quit [Ping timeout: 248 seconds]
jenrzzz has joined #ruby
Fusl has quit [Max SendQ exceeded]
Fusl has joined #ruby
xco has quit [Quit: xco]
Thenekofell has joined #ruby
cornfeedhobo has quit [Ping timeout: 245 seconds]
dviola has joined #ruby
involans has quit [Quit: involans]
lepepe_ has quit [Remote host closed the connection]
lepepe has joined #ruby
lepepe has quit [Ping timeout: 248 seconds]
ElFerna has joined #ruby
Swyper has joined #ruby
DaRock has joined #ruby
lepepe_ has joined #ruby
cornfeedhobo has joined #ruby
aither has quit [Ping timeout: 272 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
lepepe has joined #ruby
lepepe_ has quit [Ping timeout: 248 seconds]
Swyper has quit [Remote host closed the connection]
chalkmonster has joined #ruby
chalkmonster has quit [Ping timeout: 272 seconds]
s3nd1v0g1us has joined #ruby
xco has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
dbugger has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
xfbs has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
lepepe has quit [Remote host closed the connection]
lepepe has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
lepepe has quit [Ping timeout: 245 seconds]
xfbs has joined #ruby
jenrzzz has joined #ruby
ur5us has quit []
jenrzzz has quit [Ping timeout: 268 seconds]
ElFerna has quit [Ping timeout: 272 seconds]
s3nd1v0g1us has quit [Ping timeout: 246 seconds]
s3nd1v0g1us has joined #ruby
fr3tz0r has quit [Quit: Leaving]
peterson has joined #ruby
peterson has quit [Remote host closed the connection]
colechristensen has quit [Ping timeout: 248 seconds]
peterson has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
donofrio has quit [Remote host closed the connection]
s3nd1v0g1us has quit [Ping timeout: 245 seconds]
DTZUZO has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
jcalla has joined #ruby
teclator has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
houhoulis has joined #ruby
chalkmonster has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
peterson has quit [Remote host closed the connection]
dellavg_ has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
jmcgnh has quit [Ping timeout: 258 seconds]
jmcgnh has joined #ruby
chalkmonster has joined #ruby
t3hyoshi has quit [Quit: ZNC - https://znc.in]
t3hyoshi has joined #ruby
marvin__ has joined #ruby
marvin__ has left #ruby [#ruby]
conta has joined #ruby
absolutejam has joined #ruby
Autolycus has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
kyrylo has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
conta has quit [Ping timeout: 246 seconds]
conta has joined #ruby
kyrylo has quit [Client Quit]
ivanskie has joined #ruby
<ivanskie> hi
<phaul> hi
<ivanskie> is anyone using ElastiCache Redis on aws with encryption at rest and in transit turned on?
<ivanskie> hmm i guess this is more of a rails question
Autolycus has quit []
aither has joined #ruby
tdy has joined #ruby
johnny56 has quit [Ping timeout: 272 seconds]
johnny56 has joined #ruby
Thenekofell has quit [Ping timeout: 246 seconds]
DTZUZO has quit [Ping timeout: 258 seconds]
jenrzzz has quit [Ping timeout: 246 seconds]
DTZUZO has joined #ruby
SeepingN has joined #ruby
queip has quit [Ping timeout: 272 seconds]
chalkmonster has joined #ruby
houhoulis has quit [Remote host closed the connection]
schne1der has joined #ruby
andikr has joined #ruby
queip has joined #ruby
kyrylo has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
silviu has quit [Remote host closed the connection]
silviu has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
absolutejam has quit [Ping timeout: 245 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
Guest62509 has quit [Quit: All for nothing]
olspookishmagus has joined #ruby
conta has quit [Ping timeout: 245 seconds]
emptyflask has quit [Ping timeout: 252 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
aupadhye has joined #ruby
snickers has joined #ruby
vondruch has joined #ruby
queip has quit [Ping timeout: 248 seconds]
queip has joined #ruby
lxsameer has joined #ruby
Thenekofell has joined #ruby
Dr_MDMA_MD has quit [Quit: Connection closed for inactivity]
code_zombie has quit [Quit: Leaving]
absolutejam has joined #ruby
ascarter has joined #ruby
TomyWork has joined #ruby
m04ftKK has joined #ruby
<m04ftKK> Why this doesn't works ruby -e '3.times { |n| exec("echo #{n}") }
<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
<phaul> &ri Kernel#exec
<ytti> because exec works same as in shells
<ytti> it replaces the current running process
<ytti> if you do that in your bash or zsh or whatever, same thing happens
<ytti> use-case is some wrapper which is meant to do something and lauch some program with some arguments
<m04ftKK> This works ruby -e '3.times { |n| fork { exec("echo #{n}") }}'
<ytti> because it replaced the forked pid
<ytti> not the ruby pid
<ytti> you may want
<ytti> %x("command here")
<ytti> or system("command here")
<ytti> instead
<ytti> however, personally, I would always use popen3
<ytti> because shell interpretation usually is undesirable and dangerous
<ytti> and with popen3 you can pass name of executable and its arguments separately
m04ftKK has quit [Quit: This computer has gone to sleep]
<ytti> super
<phaul> altough echo in this example is probably built in
<ytti> maybe
m04ftKK has joined #ruby
<ytti> i think programmign languages like ruby, should make shell expansion the special case
<ytti> and system(bin, args) the common case
<ytti> so that it would be easy to code safe
<ytti> and hard to code unsafe
<ytti> now it's the converse, people code unsafe shell execution, because the safe way is bit more trouble and they are not aware of the implications
queip has quit [Ping timeout: 268 seconds]
<phaul> I rarely use ruby as a shell script replacement so I almost never need to call external programs. Even when there is functionality I prefer a lib
<m04ftKK> ruby -e '3.times { |n| %x("echo #{n}") }'
<m04ftKK> sh: echo 0: command not found
<m04ftKK> sh: echo 1: command not found
<m04ftKK> sh: echo 2: command not found
m04ftKK has quit [Quit: This computer has gone to sleep]
queip has joined #ruby
reber has joined #ruby
m04ftKK has joined #ruby
<phaul> ruby -e '3.times { |n| puts %x("echo" "#{n}") }' # works
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
m04ftKK has quit [Client Quit]
nitza has joined #ruby
deepredsky has joined #ruby
nitza has quit [Quit: Mutter: www.mutterirc.com]
absolutejam has quit [Ping timeout: 246 seconds]
teclator has joined #ruby
deepredsky has quit [Ping timeout: 245 seconds]
conta has quit [Remote host closed the connection]
conta has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
BH23 has joined #ruby
BH23 has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
claudiuinberlin has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
deepredsky has joined #ruby
chalkmonster has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
chalkmonster has joined #ruby
c0ncealed4 has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
ivanskie has joined #ruby
ellcs has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
jenrzzz has joined #ruby
chalkmonster has joined #ruby
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
dviola has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
m04ftKK has joined #ruby
m04ftKK has quit [Client Quit]
chalkmonster has quit [Quit: WeeChat 2.5]
Thenekofell has quit [Ping timeout: 250 seconds]
m04ftKK has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
m04ftKK has quit [Client Quit]
NL3limin4t0r_afk is now known as NL3limin4t0r
tdy has joined #ruby
<manveru> %x still needs escaping, while `"" ""` may look like two separate strings, they actually become one
<manveru> > "a" "b"
<manveru> >> "a" "b"
<ruby[bot]> manveru: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<manveru> heh
tdy has quit [Ping timeout: 245 seconds]
<NL3limin4t0r> &>> "a" "b"
<rubydoc> # => "ab" (https://carc.in/#/r/77vi)
<manveru> thanks :)
<manveru> guess that's not documented
<NL3limin4t0r> rubybot got recently some new sytax. I still have to figure out how to let rubybot point to documentation.
m04ftKK has joined #ruby
<NL3limin4t0r> The only thing that I don't understand is why use: puts %x("echo" "#{n}") instead of: puts %x(echo #{n})
m04ftKK has quit [Client Quit]
<NL3limin4t0r> %x is comparable with %q
<NL3limin4t0r> &>> %("echo" "#{0}") # might not be a valid shell command
<rubydoc> # => "\"echo\" \"0\"" (https://carc.in/#/r/77vj)
m04ftKK has joined #ruby
<NL3limin4t0r> &>> %(echo #{0}) # is valid
<rubydoc> # => "echo 0" (https://carc.in/#/r/77vk)
m04ftKK has quit [Client Quit]
conta has quit [Ping timeout: 245 seconds]
* NL3limin4t0r needs to restart his PC to finish up some system updates
<NL3limin4t0r> brb
NL3limin4t0r has quit [Quit: WeeChat 1.9.1]
m04ftKK has joined #ruby
m04ftKK has quit [Client Quit]
jenrzzz has quit [Ping timeout: 248 seconds]
<manveru> &>> %x(echo $3.50)
<rubydoc> # => "" (https://carc.in/#/r/77vm)
conta has joined #ruby
Thenekofell has joined #ruby
NL3limin4t0r has joined #ruby
m04ftKK has joined #ruby
m04ftKK has quit [Client Quit]
drnerdius has joined #ruby
dviola has joined #ruby
dviola has quit [Changing host]
dviola has joined #ruby
m04ftKK has joined #ruby
m04ftKK has quit [Quit: This computer has gone to sleep]
m04ftKK has joined #ruby
<drnerdius> Hello, everyone! My friend recommended to ask this question here. So, I was trying to programmatically fill a 3×3 2D array with numbers from 1 to 9, but for some reason, it fills in all 3 subarrays with last three numbers. Here's the code: ```a = Array.new(3, Array.new(3, 0)); a.each_with_index {|val, i| val.each_with_index {|_val, j| a[i][j] = 3 * i + j}}```. Then I tried to use a global variable to see what was really going on and print the variable
<drnerdius> values as it ran, but I got even more confused, because it prints everything as it shouls, but the resulting array is still wrong. Code: ```a = Array.new(3, Array.new(3, 0)); $n = 0; a.each_with_index {|_val, i| a[i].each_with_index {|_val, j| $n += 1; a[i][j] = $n; p "#{i}, #{j} - #{$n}"}}``` Is there a reason why this is happening? And what's the right way of doing this?
m04ftKK has quit [Quit: This computer has gone to sleep]
jenrzzz has joined #ruby
queip has quit [Ping timeout: 268 seconds]
m04ftKK has joined #ruby
r3m has quit [Quit: WeeChat 2.6-dev]
r3m has joined #ruby
d^sh has quit [Ping timeout: 245 seconds]
<dionysus69> >> 1 + 2
<ruby[bot]> dionysus69: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<dionysus69> << 1 + 2
<dionysus69> < 1 + 2
<dionysus69> << ruby 1 + 2
<dionysus69> << 1 + 2
<al2o3-cr> &>> (1..9).each_slice(3).to_a
<rubydoc> # => [[1, 2, 3], [4, 5, 6], [7, 8, 9]] (https://carc.in/#/r/77vq)
<dionysus69> &>> "lol"
<rubydoc> # => "lol" (https://carc.in/#/r/77vr)
conta has quit [Ping timeout: 268 seconds]
<dionysus69> drnerdius says thanks al2o3-cr
d^sh has joined #ruby
queip has joined #ruby
<manveru> &>> Array.new(3){|x| Array.new(3){|y| (x+1) * (y+1) }}
<rubydoc> # => [[1, 2, 3], [2, 4, 6], [3, 6, 9]] (https://carc.in/#/r/77vs)
<manveru> but not sure if that's what you expect as result... :)
chalkmonster has joined #ruby
akem-lnvo has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
<drnerdius> al2o3-cr, manveru, thanks! A lot better, but any ideas what's wrong with my approach? Why is Ruby evaluating it like this?
conta has joined #ruby
<drnerdius> &>> a = Array.new(3, Array.new(3, 0)); a.each_with_index {|_val, i| a[i].each_with_index {|_val, j| a[i][j] = 3 * i + j}}
<rubydoc> # => [[6, 7, 8], [6, 7, 8], [6, 7, 8]] (https://carc.in/#/r/77vu)
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr> drnerdius: use the block form of Array.new
dviola has quit [Quit: WeeChat 2.5]
<al2o3-cr> &>> a = Array.new(3) { Array.new(3, 0) }; a.each_with_index {|_val, i| a[i].each_with_index {|_val, j| a[i][j] = 3 * i + j}}
<rubydoc> # => [[0, 1, 2], [3, 4, 5], [6, 7, 8]] (https://carc.in/#/r/77vz)
<drnerdius> al2o3-cr, I understand; I was just asking about the behaviour.
jenrzzz has joined #ruby
AJA4350 has joined #ruby
<al2o3-cr> drnerdius: well, it uses the same references
chalkmonster has quit [Quit: WeeChat 2.5]
<al2o3-cr> with the block form you're creating individual objects
jenrzzz has quit [Ping timeout: 245 seconds]
<al2o3-cr> &>> a = Array.new(3, Array.new(3, 'x')); a[0][0] = 'y'; a
<rubydoc> # => [["y", "x", "x"], ["y", "x", "x"], ["y", "x", "x"]] (https://carc.in/#/r/77w1)
<al2o3-cr> &>> a = Array.new(3) { Array.new(3) { 'x' } }; a[0][0] = 'y'; a
<rubydoc> # => [["y", "x", "x"], ["x", "x", "x"], ["x", "x", "x"]] (https://carc.in/#/r/77w2)
<al2o3-cr> if that makes sense drnerdius
<drnerdius> al2o3-cr, thanks a lot! Also, what's the best way to transose and mutate that array? There's no transpose! method AFAIK. This is not the onlyexample; in many cases, there are no mutating counterparts to methods.
<drnerdius> transpose*
ElFerna has joined #ruby
<al2o3-cr> there is a transpose method and just save it to a another variable
<al2o3-cr> &>> [[1,2,3], [4,5,6], [7,8,9]].transpose
<rubydoc> # => [[1, 4, 7], [2, 5, 8], [3, 6, 9]] (https://carc.in/#/r/77w3)
<drnerdius> Yep, but I'm asking wether or not you can avoid that in case you don't want to allocatea memory for that.
<al2o3-cr> oh, sorry yeah, there is not counter-part mutating method
<drnerdius> Can I prepend it with something to mutate the array instead of re-assigning the value?
paraxial has quit [Ping timeout: 272 seconds]
paraxial2 has joined #ruby
<al2o3-cr> drnerdius: i'm not sure i understand what you mean?
m04ftKK has quit [Quit: This computer has gone to sleep]
queip has quit [Ping timeout: 245 seconds]
<drnerdius> Like calling with map! or something to change the array dirrectly rather than do ```a = a.transpose```
<drnerdius> If that makes sense
m04ftKK has joined #ruby
<al2o3-cr> drnerdius: ah!
<al2o3-cr> you'd have to write your own method though.
phaul has quit [Ping timeout: 272 seconds]
<drnerdius> al2o3-cr, I though so. Thanks a lot again.
<al2o3-cr> drnerdius: sure, np.
queip has joined #ruby
phaul has joined #ruby
jenrzzz has joined #ruby
chalkmonster has joined #ruby
Thenekofell has quit [Ping timeout: 252 seconds]
phaul has quit [Ping timeout: 248 seconds]
phaul has joined #ruby
conta has quit [Ping timeout: 272 seconds]
queip has quit [Ping timeout: 244 seconds]
deepredsky has quit [Ping timeout: 244 seconds]
absolutejam has joined #ruby
queip has joined #ruby
conta1 has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
snickers has quit [Quit: Textual IRC Client: www.textualapp.com]
snickers has joined #ruby
<al2o3-cr> NL3limin4t0r: nifty :)
<NL3limin4t0r> You can make your own method more memory efficient. But this is an simple example
<livcd> Anyone tried Sorbet?
absolutejam has quit [Ping timeout: 258 seconds]
<drnerdius> NL3limin4t0r, that's awesome, but I wonder why mutating methods need to be implemented as new ones. Can't Ruby developers make it a part of the syntax?
kyrylo has joined #ruby
RiPuk has joined #ruby
<al2o3-cr> i suppose some methods don't warrant mutation.
<al2o3-cr> &>> Array.instance_methods(false).grep /!/
<rubydoc> # => [:rotate!, :sort!, :sort_by!, :collect!, :map!, :select!, :filter!, :reject!, :uniq!, :flatten!,... check link for more (https://carc.in/#/r/77w8)
<NL3limin4t0r> Also, not all mutating methods end with an exclamation mark.
<al2o3-cr> NL3limin4t0r: true, like concat
<al2o3-cr> and clear :)
<NL3limin4t0r> In my code snippet I use Array#clear and Array#concat with are both mutating methods.
<NL3limin4t0r> Some muting methods have also have quite another syntax than there non-mutating counterpart.
<NL3limin4t0r> string_var += "new string"
<NL3limin4t0r> vs
<NL3limin4t0r> string_var << "new string"
<al2o3-cr> but ones an operator the other a method
m04ftKK has quit [Quit: This computer has gone to sleep]
solars has joined #ruby
Inline has joined #ruby
lepepe has joined #ruby
lepepe has quit [Read error: Connection reset by peer]
lepepe has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
lepepe has quit [Ping timeout: 268 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
absolutejam has joined #ruby
jenrzzz has joined #ruby
claudiuinberlin has joined #ruby
m04ftKK has joined #ruby
<drnerdius> Thanks to both of you. :-)
akem-lnvo has quit [Ping timeout: 248 seconds]
bvdw has quit [Read error: Connection reset by peer]
<al2o3-cr> :P
alan_w has joined #ruby
conta1 has quit [Ping timeout: 258 seconds]
involans has joined #ruby
deepredsky has joined #ruby
RiPuk has quit [Ping timeout: 245 seconds]
lepepe has joined #ruby
lepepe has quit [Remote host closed the connection]
lepepe has joined #ruby
involans has quit [Quit: involans]
involans has joined #ruby
ljarvis__ has joined #ruby
unreal_ has joined #ruby
JasonO has quit [Excess Flood]
jtdowney has quit [Quit: Ping timeout (120 seconds)]
jtdowney has joined #ruby
deepredsky has quit [Ping timeout: 246 seconds]
ljarvis_ has quit [Ping timeout: 245 seconds]
unreal has quit [Ping timeout: 245 seconds]
JasonO has joined #ruby
absolutejam has quit [Ping timeout: 268 seconds]
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
caduguedess has joined #ruby
GodFather has joined #ruby
deepredsky has joined #ruby
lepepe_ has joined #ruby
AndreYuhai has joined #ruby
lepepe has quit [Ping timeout: 248 seconds]
<AndreYuhai> Hi there, how do I loop through months instead of all all the days withing the two months?
<AndreYuhai> for example : 2019, 05 -> 2019, 07 I want to loop through 2019, 05 / 2019, 06 / 2019, 07
<AndreYuhai> date.downto or upto loops through all the days
Dr_MDMA_MD has joined #ruby
conta1 has joined #ruby
teclator has quit [Ping timeout: 246 seconds]
chalkmonster has joined #ruby
teclator has joined #ruby
RiPuk has joined #ruby
deepredsky has quit [Ping timeout: 245 seconds]
jottr has joined #ruby
<al2o3-cr> AndreYuhai: https://carc.in/#/r/77wd
Inline__ has joined #ruby
Inline has quit [Ping timeout: 264 seconds]
alan_w has quit [Quit: WeeChat 2.4]
snickers has joined #ruby
ghostlines has joined #ruby
<AndreYuhai> al2o3-cr: Thank you.
teclator has quit [Ping timeout: 246 seconds]
snickers has quit [Client Quit]
tf2ftw has joined #ruby
<al2o3-cr> AndreYuhai: np. :)
teclator has joined #ruby
lucasb has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
deepredsky has joined #ruby
cyclonis has joined #ruby
augcesar has quit [Quit: Connection closed for inactivity]
deepredsky has quit [Ping timeout: 245 seconds]
skryking has joined #ruby
ElFerna has quit [Ping timeout: 258 seconds]
lepepe_ has quit [Read error: Connection reset by peer]
lepepe has joined #ruby
lepepe has quit [Read error: Connection reset by peer]
emptyflask has joined #ruby
lepepe has joined #ruby
caduguedess has quit [Quit: Leaving.]
caduguedess has joined #ruby
fuzzface has joined #ruby
green- has quit [Remote host closed the connection]
tdy has joined #ruby
conta1 has quit [Read error: Connection reset by peer]
conta1 has joined #ruby
lepepe has quit [Remote host closed the connection]
lepepe has joined #ruby
RiPuk has quit [Ping timeout: 245 seconds]
lepepe_ has joined #ruby
Esa_ has joined #ruby
RiPuk has joined #ruby
lepepe has quit [Ping timeout: 244 seconds]
rippa has joined #ruby
tf2ftw has quit [Quit: This computer has gone to sleep]
yalue has joined #ruby
lepepe has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
lepepe_ has quit [Ping timeout: 245 seconds]
lepepe_ has joined #ruby
lepepe has quit [Ping timeout: 245 seconds]
ElFerna has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
Nicmavr has quit [Read error: Connection reset by peer]
lepepe has joined #ruby
lepepe_ has quit [Ping timeout: 248 seconds]
<drnerdius> Can you also get an index of each iteration with `Array.new(3) { <block> }`?
Nicmavr has joined #ruby
lepepe_ has joined #ruby
<drnerdius> Obviously it's doing some kind of loop
<drnerdius> &>> Array.new(3) { p :test }
<rubydoc> # => :test (https://carc.in/#/r/77x2)
<drnerdius> &>> Array.new(3) { Array.new(3, 0); p :test }
<rubydoc> # => :test (https://carc.in/#/r/77x3)
<drnerdius> &>> Array.new(3) { Array.new(3, 0); p 5 }
<rubydoc> # => 5 (https://carc.in/#/r/77x4)
<al2o3-cr> Array.new(3) { |index| ...
lepepe has quit [Ping timeout: 245 seconds]
ellcs has quit [Ping timeout: 245 seconds]
emptyflask has quit [Ping timeout: 264 seconds]
<drnerdius> Haha, that was stupidly easy
<drnerdius> &>> Array.new(3) {|index| Array.new(3, 0); p index }
<rubydoc> # => 0 (https://carc.in/#/r/77x5)
<drnerdius> (DOesn't work here, but it does in IRB)
<drnerdius> Thanks
<al2o3-cr> yw ;)
chalkmonster has joined #ruby
ElFerna has quit [Ping timeout: 268 seconds]
RiPuk has quit [Ping timeout: 245 seconds]
drnerdius has quit [Ping timeout: 245 seconds]
RiPuk has joined #ruby
teclator_ has joined #ruby
tf2ftw has joined #ruby
teclator has quit [Ping timeout: 272 seconds]
retromode has joined #ruby
tf2ftw has quit [Client Quit]
lepepe_ has quit [Ping timeout: 246 seconds]
<retromode> is there a method on collections like 'each_with_index' but that stops mapping once we've reached a certain index?
lepepe_ has joined #ruby
SeepingN has joined #ruby
<havenwood> retromode: take(index + 1).each_with_index
akem-lnvo has joined #ruby
RiPuk_ has joined #ruby
RiPuk has quit [Ping timeout: 246 seconds]
<retromode> havenwood that works, thanks!
<havenwood> retromode: or you can `break` once you reach the index you're looking for!
<retromode> yeah, i was doing that but was hoping there were something more elegant :)
xco has quit [Quit: xco]
teclator_ has quit [Ping timeout: 258 seconds]
teclator has joined #ruby
RiPuk_ has quit [Ping timeout: 245 seconds]
tf2ftw has joined #ruby
RiPuk has joined #ruby
lepepe has joined #ruby
lepepe_ has quit [Ping timeout: 246 seconds]
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
retromode has quit [Remote host closed the connection]
aupadhye has quit [Quit: Leaving]
tdy has quit [Ping timeout: 272 seconds]
lepepe has quit [Ping timeout: 248 seconds]
lepepe has joined #ruby
ivanskie has joined #ruby
caduguedess has quit [Remote host closed the connection]
chalkmonster has quit [Quit: WeeChat 2.5]
queip has quit [Ping timeout: 245 seconds]
TomyWork has quit [Remote host closed the connection]
queip has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe_ has quit [Read error: Connection reset by peer]
akem-lnvo has quit [Ping timeout: 268 seconds]
conta1 has quit [Read error: Connection reset by peer]
megamos has joined #ruby
m04ftKK has quit [Quit: Leaving]
iffraff has joined #ruby
ivanskie has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lepepe has quit [Read error: Connection reset by peer]
lepepe has joined #ruby
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
andikr has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 258 seconds]
queip has quit [Ping timeout: 245 seconds]
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
DTZUZO has quit [Ping timeout: 268 seconds]
lepepe has quit [Remote host closed the connection]
lepepe has joined #ruby
Bounga has joined #ruby
queip has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DaRock has quit [Ping timeout: 258 seconds]
lepepe has quit [Ping timeout: 244 seconds]
ivanskie has joined #ruby
moei has joined #ruby
lepepe has joined #ruby
lepepe has quit [Remote host closed the connection]
lepepe has joined #ruby
paraxial2 has quit [Quit: The Lounge - https://thelounge.chat]
paraxial2 has joined #ruby
orbyt_ has joined #ruby
tdy has joined #ruby
iffraff has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
paraxial2 has quit [Ping timeout: 268 seconds]
paraxial2 has joined #ruby
lepepe has quit [Ping timeout: 245 seconds]
lepepe has joined #ruby
psilly0 has joined #ruby
RiPuk has quit [Ping timeout: 246 seconds]
claudiuinberlin has joined #ruby
lepepe has quit [Read error: Connection reset by peer]
lepepe has joined #ruby
miskatonic has joined #ruby
miskatonic has quit [Client Quit]
tf2ftw has quit [Quit: This computer has gone to sleep]
tf2ftw has joined #ruby
RiPuk has joined #ruby
tf2ftw has quit [Quit: This computer has gone to sleep]
lepepe_ has joined #ruby
lepepe has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 246 seconds]
lxsameer has quit [Quit: out]
RiPuk has quit [Ping timeout: 244 seconds]
budonyc has quit [Ping timeout: 272 seconds]
Swyper has joined #ruby
lepepe_ has quit [Read error: Connection reset by peer]
RiPuk has joined #ruby
lepepe has joined #ruby
gell5 has joined #ruby
cyclonis has quit [Ping timeout: 248 seconds]
cyclonis_ has joined #ruby
cyclonis_ has quit [Read error: Connection reset by peer]
Swyper has quit [Remote host closed the connection]
gix has joined #ruby
jenrzzz has joined #ruby
Swyper has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
lepepe has quit [Ping timeout: 245 seconds]
lepepe has joined #ruby
Swyper has quit [Remote host closed the connection]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
Swyper has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
AndreYuhai has quit [Remote host closed the connection]
AndreYuhai has joined #ruby
tdy has quit [Ping timeout: 268 seconds]
AndreYuhai has quit [Remote host closed the connection]
AndreYuhai has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
bga57 has quit [Ping timeout: 246 seconds]
tf2ftw has joined #ruby
tf2ftw has quit [Client Quit]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
bga57 has joined #ruby
<baweaver> havenwood / retromode: why not just use slices?
yalue has quit [Quit: Leaving]
<baweaver> list[0..(index + 1)].each_with_index ...
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline__ has quit [Quit: Leaving]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
Inline has joined #ruby
bga57 has quit [Ping timeout: 245 seconds]
<baweaver> or first, or several other bits
Swyper has quit [Remote host closed the connection]
<baweaver> Ah, also havenwood, TIL: [1,2].first(1)
lepepe has quit [Read error: Connection reset by peer]
<baweaver> &>> [1,2].first(1)
<rubydoc> # => [1] (https://carc.in/#/r/77xy)
lepepe has joined #ruby
cyclonis has joined #ruby
Swyper has joined #ruby
bga57 has joined #ruby
Bounga has quit [Ping timeout: 252 seconds]
lepepe_ has joined #ruby
lepepe has quit [Ping timeout: 258 seconds]
tf2ftw has joined #ruby
lepepe_ has quit [Ping timeout: 245 seconds]
NL3limin4t0r has quit [Quit: WeeChat 1.9.1]
tf2ftw has quit [Client Quit]
Sauvin has quit [Ping timeout: 248 seconds]
lepepe has joined #ruby
TomyLobo has joined #ruby
lxsameer has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
cyclonis_ has joined #ruby
cyclonis has quit [Ping timeout: 258 seconds]
jenrzzz has quit [Ping timeout: 272 seconds]
xco has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cyclonis_ has quit [Quit: -a- Connection Timed Out]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
sezuan has quit [Quit: ____]
drnerdius has joined #ruby
jenrzzz has joined #ruby
lepepe has quit [Ping timeout: 268 seconds]
lepepe_ has joined #ruby
tomaw has quit [Quit: Quitting]
tomaw has joined #ruby
ivanskie has joined #ruby
kyrylo has joined #ruby
houhoulis has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
zapata has joined #ruby
absolutejam has joined #ruby
BloopMonster has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
redlegion has quit [Quit: The Lounge - https://thelounge.chat]
zapata has quit [Quit: WeeChat 2.5]
redlegion has joined #ruby
Thenekofell has joined #ruby
psilly0 has quit [Ping timeout: 272 seconds]
BloopMonster has quit [Quit: WeeChat 1.9.1]
jenrzzz has joined #ruby
Swyper has quit [Remote host closed the connection]
BloopMonster has joined #ruby
dellavg_ has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Ping timeout: 244 seconds]
Swyper has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
fuzzface has quit [Quit: Leaving]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has joined #ruby
Snowy has joined #ruby
Swyper has quit [Remote host closed the connection]
kyrylo has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 272 seconds]
absolutejam2 has joined #ruby
lepepe_ has quit [Ping timeout: 244 seconds]
absolutejam has quit [Ping timeout: 244 seconds]
lepepe has joined #ruby
jenrzzz has joined #ruby
ElFerna has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
involans has quit [Quit: involans]
absolutejam3 has joined #ruby
absolutejam2 has quit [Ping timeout: 245 seconds]
pygmypuppy has joined #ruby
Thenekofell has quit [Ping timeout: 250 seconds]
Fernando-Basso has joined #ruby
lepepe_ has joined #ruby
lepepe has quit [Ping timeout: 272 seconds]
bsdbandit has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
lepepe_ has quit [Remote host closed the connection]
lepepe has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
fphilipe_ has quit [Ping timeout: 276 seconds]
lepepe has quit [Ping timeout: 244 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Snowy has quit [Read error: Connection reset by peer]
queip has quit [Ping timeout: 244 seconds]
Thenekofell has joined #ruby
Snowy has joined #ruby
Thenekofell has quit [Remote host closed the connection]
Snowy has quit [Client Quit]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drnerdius has quit [Ping timeout: 245 seconds]
queip has joined #ruby
c0ncealed4 has quit [Remote host closed the connection]
claudiuinberlin has joined #ruby
matheusmoreira has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
fphilipe_ has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
cammellos has quit [Ping timeout: 245 seconds]
emptyflask has joined #ruby
xco has quit [Quit: xco]
code_zombie has joined #ruby
lepepe has joined #ruby
lepepe has quit [Ping timeout: 245 seconds]
Dr_MDMA_MD has quit [Quit: Connection closed for inactivity]
budonyc has joined #ruby
Inline has quit [Quit: Leaving]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ghostlines has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
houhoulis has quit [Remote host closed the connection]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
involans has joined #ruby
SanguineAnomaly has quit [Ping timeout: 246 seconds]
reber has quit [Read error: Connection reset by peer]
schne1der has quit [Ping timeout: 245 seconds]
claudiuinberlin has joined #ruby
Dr_MDMA_MD has joined #ruby
involans has quit [Quit: involans]
DTZUZO has joined #ruby
Swyper has joined #ruby
SanguineAnomaly has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
absolutejam3 has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
dbugger has quit [Quit: Leaving]
DTZUZO has quit [Ping timeout: 245 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
lucasb has quit [Quit: Connection closed for inactivity]
fphilipe_ has quit [Ping timeout: 252 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350