havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: 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!
adu_ has joined #ruby
adu_ has quit [Client Quit]
adu has quit [Ping timeout: 240 seconds]
cthulchu has quit [Read error: Connection reset by peer]
cthulchu has joined #ruby
TCZ has quit [Quit: Leaving]
alexherbo2 has quit [Ping timeout: 272 seconds]
drincruz has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
jenrzzz has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
d_kam has joined #ruby
adu has joined #ruby
chouhoulis has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
ur5us_ has joined #ruby
jenrzzz has joined #ruby
mistergibson has quit [Quit: Leaving]
Swyper_ has joined #ruby
drincruz has joined #ruby
Swyper has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
jordanm has quit [Ping timeout: 264 seconds]
jordanm has joined #ruby
dionysus69 has quit [Ping timeout: 258 seconds]
meinside has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
drincruz has joined #ruby
Fusl has quit [Ping timeout: 260 seconds]
adu has quit [Quit: adu]
Fusl has joined #ruby
adu has joined #ruby
Swyper_ has quit [Ping timeout: 260 seconds]
Swyper has joined #ruby
zacts has joined #ruby
gix has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
deimos_ has quit [Quit: leaving]
deimos_ has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
chouhoulis has quit [Remote host closed the connection]
adu has quit [Quit: adu]
dead10cc has joined #ruby
adu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
alfiemax has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
alexherbo2 has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
znz_jp has quit [Remote host closed the connection]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
Nowaker has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
znz_jp has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
zacts has quit [Ping timeout: 272 seconds]
wallace_mu has joined #ruby
adu has quit [Quit: adu]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
adu has joined #ruby
postmodern has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
ChmEarl has quit [Quit: Leaving]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
iNs has quit [Remote host closed the connection]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
iNs has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
jhass has quit [Remote host closed the connection]
wallace_mu has quit [Remote host closed the connection]
jhass has joined #ruby
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
drincruz has quit [Ping timeout: 272 seconds]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
donofrio has quit [Remote host closed the connection]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
rafadc has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
tubbo has quit [Ping timeout: 244 seconds]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
dead10cc has quit [Quit: Connection closed]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
wallace_mu has quit [Remote host closed the connection]
baojg has joined #ruby
wallace_mu has joined #ruby
wallace_mu has quit [Ping timeout: 256 seconds]
tubbo has joined #ruby
BSaboia has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
Swyper has quit [Remote host closed the connection]
cthulchu has quit [Ping timeout: 272 seconds]
lxsameer has quit [Ping timeout: 272 seconds]
duderonomy has joined #ruby
iscke has quit [Remote host closed the connection]
iscke has joined #ruby
peach_liqueur has joined #ruby
peach_liqueur has quit [Remote host closed the connection]
peach_liqueur has joined #ruby
peach_liqueur has quit [Remote host closed the connection]
iscke has quit [Ping timeout: 260 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
peach_liqueur has joined #ruby
peach_liqueur has quit [Remote host closed the connection]
zenspider has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
zenspider has joined #ruby
baojg has quit [Remote host closed the connection]
baojg_ has joined #ruby
zacts has joined #ruby
hiroaki has joined #ruby
hiroaki has quit [Ping timeout: 265 seconds]
vondruch has joined #ruby
x0n has quit [Read error: Connection reset by peer]
x0n has joined #ruby
lxsameer has joined #ruby
schne1der has joined #ruby
baojg has joined #ruby
baojg_ has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
jud has joined #ruby
phage has joined #ruby
jud^ has joined #ruby
^jud has joined #ruby
adu has quit [Quit: adu]
jud has quit [Ping timeout: 256 seconds]
jud^ has quit [Ping timeout: 260 seconds]
gigetoo has quit [Ping timeout: 240 seconds]
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jud^ has joined #ruby
^jud has quit [Ping timeout: 260 seconds]
vondruch has joined #ruby
Swyper has joined #ruby
ellcs has joined #ruby
jud^ has quit [Quit: Leaving]
Swyper has quit [Remote host closed the connection]
imode has quit [Ping timeout: 265 seconds]
greengriminal has joined #ruby
cd has quit [Quit: cd]
BSaboia has joined #ruby
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Swyper has joined #ruby
gigetoo has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
supercoven_ has joined #ruby
supercoven has quit [Ping timeout: 265 seconds]
duderonomy has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
braincrash has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
Furai has quit [Quit: WeeChat 2.9]
Furai has joined #ruby
Mia has quit [Ping timeout: 260 seconds]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
braincrash has quit [Ping timeout: 256 seconds]
CrazyEddy has joined #ruby
dionysus69 has joined #ruby
dhollinger has quit [Ping timeout: 272 seconds]
dhollinger has joined #ruby
supercoven has joined #ruby
TCZ has joined #ruby
supercoven__ has joined #ruby
supercoven_ has quit [Ping timeout: 272 seconds]
supercoven has quit [Ping timeout: 256 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
supercoven has joined #ruby
braincrash has joined #ruby
supercoven__ has quit [Ping timeout: 260 seconds]
ur5us_ has joined #ruby
punnie has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
teclator has quit [Ping timeout: 260 seconds]
akem has quit [Ping timeout: 256 seconds]
ruurd has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
teclator has joined #ruby
akem has joined #ruby
TzilTzal has joined #ruby
teclator has quit [Client Quit]
akem has quit [Quit: Leaving]
impermanence has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
teclator has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
klaas_ has joined #ruby
klaas has quit [Read error: Connection reset by peer]
supercoven has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
phage has joined #ruby
phage has quit [Client Quit]
lucianp has quit [Ping timeout: 256 seconds]
supercoven has joined #ruby
supercoven_ has joined #ruby
supercoven has quit [Ping timeout: 260 seconds]
d_kam has quit [Quit: Lingo: www.lingoirc.com]
drincruz has joined #ruby
<rapha> hi all
drincruz has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
<rapha> how do you write something yourself that takes a block, such as Array#each? specifically, I want a method called walk_tree_for_keys(/some_regex/){|value| here_i_can_do_something_based_on_the_value_of_each_key_that_matched_the_regex} ... would that work with yield() somehow, inside of `def walk_tree_for_keys`?
akem has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
drincruz has joined #ruby
<leftylink> so maybe it is best to answer shortly and say "yes, yield. try making and running a short example to prove to yourself that this works". I think that would be appropriate if we are *not* including the feature "if no block is given, instead return an enumerator" which is a common feature of many of those methods in the standard library
<leftylink> if that feature is needed, then... more study is needed
<leftylink> (more study by me, since I do not know what they do to do that)
stryek has joined #ruby
<jhass> so for the simple case you can often just return to_enum(__method__) unless block_given?
<leftylink> interesting
<jhass> and this is essentially just some convenience sugar around Enumerator.new
<jhass> which yields you an object which you just feed stuff into, so Enumerator.new do |yielder| whatever.each do |item| yielder << item end end
<jhass> Now Enumerator stores that block and spawns a loop in a new fiber that it can suspend after retrieving an element
bmurt has joined #ruby
<jhass> but I agree, I doubt rapha needs an enumerator yet :D
impermanence has joined #ruby
TCZ has joined #ruby
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
romanlevin333236 has quit [Ping timeout: 246 seconds]
chouhoulis has joined #ruby
Rudd0 has quit [Ping timeout: 260 seconds]
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 256 seconds]
vondruch_ is now known as vondruch
adu has joined #ruby
adu has quit [Client Quit]
chouhoulis has quit [Ping timeout: 272 seconds]
infinityfye has joined #ruby
wallace_mu has joined #ruby
<rapha> sorry, got distracted ... reading all now
<rapha> woah
<jhass> rapha: aw, no, stick to leftylink's first line :D
<rapha> fiber
<rapha> suspend
<rapha> okay
<rapha> because that's a little above my head :P
FrostCandy has joined #ruby
pgib has quit [Quit: 00 PC LOAD LETTER]
donofrio has joined #ruby
ruby428 has joined #ruby
<ruby428> Can anyone explain the result of this code snippet?
<ruby[bot]> ruby428: 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
<adam12> ruby428: what do you mean?
<ruby428> I'm creating an enumerator of timestamps in the BST timezone, yet the enumerator.next method returns a timestamp in UTC time zone
<ruby428> That seems like incorrect behaviour
<adam12> ruby428: I'm _suspicious_ that this might be a Rails bug.
<adam12> Actually, hmm.
<rapha> ruby[bot]: but what if someone doesn't have a GitHub account and doesn
<rapha> 't want one either.
<rapha> Well, not expecting much of an answer from a bot. But wondering what the preferred place would then be.
<ruby428> I am running that snippet in a Rails environment by the way
<adam12> ruby428: Some ActiveSupport date methods mutate the receiver, which is what I thought was happening here.. but you don't re-use the same object so I'm maybe a bit lost.
<adam12> ruby428: Out of curiosity, what if you didn't use ActiveSupport methods? y << Time.now - (n * 3600)
<adam12> (they mutate the receiver but it's not obvious that they do so)
<ruby428> Ah, If I change it to what you suggested, it returns both timestamps in BST
<ruby428> so it works as I'd expect
dhollinger has quit [Ping timeout: 260 seconds]
<adam12> ruby428: So I think ActiveSupport is indeed mutating something...
<adam12> Or the time zone is lost on the second call.. mysteries.
bmurt has quit [Ping timeout: 258 seconds]
<ruby428> Yea the timezone is getting lost
<adam12> ruby428: What happens if you use Time.zone.now - (n * 3600)
<ruby428> If I put the setting of the timezone inside the enumerator, it works too
<adam12> Oh it does? Hmm
alfiemax has quit [Remote host closed the connection]
dhollinger has joined #ruby
<ruby428> Why would #first behave differently to #next
<ruby428> Something to do with Fibers maybe? I don't know much about them though
<adam12> ruby428: What happens if you output Time.zone between calls?
<adam12> ruby428: In theory, #first or #next wouldn't matter here. What if you do #last instead of #next?
alfiemax has joined #ruby
<ruby428> The Time.zone doesn't change between calls
<ruby428> hmm Enumerator doesn't implement #last
<adam12> Oh it doesn't? Huh. News to me.
<adam12> What about coercing to array?
<ruby428> Coercing to an array does keep the BST timezone
<ruby428> so it's really just the 'next' method that's causing problems...
joshcom has joined #ruby
<adam12> What Ruby version?
<adam12> And did using Time.zone.now have any change?
<ruby428> 2.6.5
<ruby428> Time.zone.now suffers from the same problem
<adam12> Can you try #peek too? See if we can narrow down if it's actually #next.
<ruby428> Peek has same problem
alfiemax has quit [Remote host closed the connection]
<adam12> And without an enumerator it's fine? [1, 2].each {|n| puts n.hours.from_now }
<ruby428> Yup
<ruby428> It seems that #each returns timestamps with the correct zone too
joshcom has quit [Remote host closed the connection]
<adam12> I mean, I guess it might be Fiber related..
<adam12> Rails stores the timezone in a Thread.current
<adam12> Could the fiber be resumed in another thread? That I'm not really sure of.
<ruby428> That's what I'm wondering. But why would it use a fiber for next/peek, but not 'each/to_a'?>
<ruby428> ah wait, I guess the fiber is used when there will be stop/starting expected
impermanence has quit [Ping timeout: 240 seconds]
<adam12> Yeah. In the C source, next definitely yields the fiber.
<adam12> It looks like it's a known problem, albeit kinda fringe. If you look at this PR, they set a value inside the Fiber loop. https://github.com/rails/rails/pull/30361/files
joshcom has joined #ruby
<adam12> s/loop/block.
zacts has quit [Quit: leaving]
zacts has joined #ruby
<ruby428> are you referring to where they set the locale?
<ruby428> are you referring to how they set the locale?
<adam12> ruby428: They capture the value of the locale in a local variable and then reset it inside the Fiber.
<adam12> ruby428: Saying you could maybe do something similar; current_zone = Time.zone; Enumerable.new; Time.zone = current_zone
<ruby428> Thanks for the help adam!
<ruby428> I think I will just set Time.zone = 'London' inside the enumerator
<adam12> ruby428: Cheers.
alfiemax has joined #ruby
ruby428 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
impermanence has joined #ruby
TCZ has quit [Quit: Leaving]
kristian_on_linu has joined #ruby
alfiemax has quit [Remote host closed the connection]
BSaboia has joined #ruby
vondruch has quit [Quit: vondruch]
Nowaker has quit [Quit: No Ping reply in 180 seconds.]
vondruch has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
dualfade has quit [Ping timeout: 264 seconds]
vondruch has quit [Client Quit]
dualfade has joined #ruby
vondruch has joined #ruby
Nowaker has joined #ruby
zacts has quit [Ping timeout: 256 seconds]
ChmEarl has joined #ruby
alfiemax has joined #ruby
ellcs1 has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 265 seconds]
zacts has joined #ruby
bamdad has joined #ruby
sagax has quit [Remote host closed the connection]
ctOS has left #ruby [#ruby]
cthulchu has joined #ruby
braincrash has quit [Ping timeout: 272 seconds]
cd has joined #ruby
zacts has quit [Quit: leaving]
zacts has joined #ruby
Rudd0 has joined #ruby
TzilTzal has quit [Quit: Leaving.]
FrostCandy has quit [Read error: Connection reset by peer]
Romain[m]1 has joined #ruby
FrostCandy has joined #ruby
ujjain2 has joined #ruby
Colpop4323 has joined #ruby
<rapha> okay, yield is nice
<rapha> but trying to design a method that takes a block and can recursively call itself, my brain is failing to function properly
Colpop4323 has quit [Ping timeout: 258 seconds]
ujjain2 has quit [Quit: Textual IRC Client: www.textualapp.com]
<havenwood> rapha: Maybe think of it in terms of passing a lambda rather than a block. It's the same mechanics.
<havenwood> rapha: I don't follow what you're doing, but here's an example of typical recursion along with a block. https://gist.github.com/havenwood/aeaf09529627db51871d60eaae2000dc
<havenwood> rapha: Note how similar the code is with a lambda proc rather than a block: https://gist.github.com/havenwood/aeaf09529627db51871d60eaae2000dc
cyrus_mc_ has joined #ruby
<rapha> havenwood: thank you for the links! i read both, but currently my eye (had a splinter in it and required drilling into the cornea) is hurting a little much. hopefully within an hour or two i can get back to this.
ChmEarl has quit [Quit: Leaving]
<havenwood> rapha: Ouch. Feel better!
sagax has joined #ruby
howdoi has joined #ruby
dead10cc has joined #ruby
cthulchu has quit [Read error: Connection reset by peer]
cthulchu has joined #ruby
chouhoulis has joined #ruby
supercoven_ has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
chouhoulis has quit [Ping timeout: 272 seconds]
dead10cc has quit [Ping timeout: 258 seconds]
chouhoulis has joined #ruby
alexherbo22 has joined #ruby
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo22 is now known as alexherbo2
lightstalker has quit [Remote host closed the connection]
dead10cc has joined #ruby
lightstalker has joined #ruby
davispuh has joined #ruby
alexherbo25 has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo25 is now known as alexherbo2
BSaboia has joined #ruby
schne1der has quit [Ping timeout: 256 seconds]
Swyper has joined #ruby
alfiemax has quit [Remote host closed the connection]
duckpuppy has quit [Remote host closed the connection]
duckpuppy has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
schne1der has joined #ruby
cyrus_mc_ has quit [Quit: Connection closed]
ramfjord has joined #ruby
rippa has joined #ruby
schne1der has quit [Ping timeout: 272 seconds]
dead10cc has left #ruby [#ruby]
zacts has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
Sauvin has quit [Read error: Connection reset by peer]
zacts has joined #ruby
duderonomy has joined #ruby
brunosaboia_ has joined #ruby
TCZ has joined #ruby
BSaboia has quit [Ping timeout: 272 seconds]
vondruch_ has joined #ruby
brunosaboia_ has quit [Ping timeout: 256 seconds]
zacts has quit [Quit: leaving]
vondruch has quit [Ping timeout: 264 seconds]
vondruch_ is now known as vondruch
infinityfye has quit [Quit: Leaving]
CrazyEddy has quit [Ping timeout: 260 seconds]
mjacob has quit [Ping timeout: 260 seconds]
duderonomy has quit [Ping timeout: 256 seconds]
punnie has quit [Quit: Connection closed for inactivity]
impermanence has quit [Ping timeout: 240 seconds]
lemur is now known as baweaver
baweaver has quit [Changing host]
baweaver has joined #ruby
duderonomy has joined #ruby
rafadc has quit [Quit: ZNC - https://znc.in]
hiroaki has joined #ruby
ramfjord has quit [Ping timeout: 272 seconds]
rafadc has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
braincrash has joined #ruby
Deesl has joined #ruby
gix has joined #ruby
imode has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
schne1der has joined #ruby
greengriminal has quit [Quit: Leaving]
Swyper has joined #ruby
russt_ has quit [Quit: That's all, folks!]
russt has joined #ruby
russt has quit [Client Quit]
duderonomy has joined #ruby
Swyper_ has joined #ruby
russt has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
dionysus69 has quit [Ping timeout: 240 seconds]
rafadc has quit [Ping timeout: 265 seconds]
cnsvc has joined #ruby
rafadc has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
Swyper_ has quit [Remote host closed the connection]
Deesl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
SunWuKung has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ChmEarl has joined #ruby
Swyper has joined #ruby
elcuervo has quit [Quit: ZNC 1.7.5 - https://znc.in]
ellcs1 has quit [Ping timeout: 244 seconds]
Deesl has joined #ruby
joshcom has quit [Quit: Leaving]
ramfjord has joined #ruby
Deesl has quit [Client Quit]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
cvbhqwfvcharstnh has joined #ruby
cvbhqwfvcharstnh has quit [Client Quit]
schne1der has quit [Ping timeout: 256 seconds]
ur5us_ has joined #ruby
BTRE has quit [Ping timeout: 260 seconds]
ramfjord has quit [Ping timeout: 260 seconds]
TCZ has quit [Quit: Leaving]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
tty1 has joined #ruby
<tty1> hi, bit of a ruby noob here despite having done quite a bit of mashing the keyboard to code in it anyway... but i need help with something and i may have something backwards in how im approaching this
<tty1> Is there a way to update the gem lockfile but without having the bundler version strictly defined?
r3my has quit [Ping timeout: 240 seconds]
s2013 has joined #ruby
fowl has quit [Ping timeout: 240 seconds]
integral has quit [Read error: Connection reset by peer]
peteretep has quit [Read error: Connection reset by peer]
redlegion has quit [Read error: Connection reset by peer]
Atro has quit [Ping timeout: 240 seconds]
kozowu has quit [Write error: Connection reset by peer]
afisher has quit [Read error: Connection reset by peer]
AutomationD has quit [Read error: Connection reset by peer]
Fenhl has quit [Read error: Connection reset by peer]
peteretep has joined #ruby
rann has quit [Read error: Connection reset by peer]
itok has quit [Write error: Connection reset by peer]
fowl has joined #ruby
dputtick has quit [Write error: Connection reset by peer]
r3my has joined #ruby
dputtick has joined #ruby
itok has joined #ruby
integral has joined #ruby
davispuhh has joined #ruby
AutomationD has joined #ruby
Atro has joined #ruby
kozowu has joined #ruby
rann has joined #ruby
davispuh has quit [Ping timeout: 240 seconds]
afisher has joined #ruby
Fenhl has joined #ruby
braincrash has quit [Ping timeout: 260 seconds]
FrostCandy has quit []
CrazyEddy has joined #ruby
ChrisBr has joined #ruby
jinie has joined #ruby
ramfjord has joined #ruby
AndreYuhai has joined #ruby
<AndreYuhai> What's wrong with this one? Basically words in the array "words" should be grouped based on their chars. order doesn't matter
<AndreYuhai> Why some words are grouped together even though they have different chars
<AndreYuhai> this got me so annoyed
tty1 has quit [Quit: WeeChat 2.9]
TCZ has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
bmurt has joined #ruby
BTRE has joined #ruby
ramfjord has joined #ruby
<leftylink> oh, phew, I thought google was going to ask me for a captcha to even view that
<leftylink> which might have made me ragequit
<leftylink> does anyone know if there's a raw version of repl.it that doesn't have so much js?
<leftylink> (yes the captcha screen did pop up for a brief instant, but it didn't come up again on a refresh)
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<leftylink> wouldn't this be easier to debug if the included the letters that each group is supposedly associated with? then it would be easy to see by hand whether each word in the group should be there or not, by comparing it to the letters.
<AndreYuhai> leftylink, I can send it on dpaste though
<leftylink> after all this is just reinventing the wheel of group_by, and group_by *would* provide this information
<AndreYuhai> If you want to try :D
<leftylink> whereas this code doesn't
nicholaslyang has joined #ruby
<AndreYuhai> leftylink, but the problem is why is this grouping wrong
<adam12> AndreYuhai: Be nicer if you had a smaller subset of output and expected response.
<leftylink> yes, taking either of these two suggestions will allow seeing why the grouping is wrong
<AndreYuhai> adam12, I just copy pasted what I got from hackerrank. I will try to make it smaller
<adam12> AndreYuhai: Are there repeats in the group?
<adam12> I think that's what I'm understanding.
<AndreYuhai> adam12, do you mean duplicated words?
<adam12> AndreYuhai: Yeah. I see "ktf" twice.
<AndreYuhai> adam12, yes, in the array "words" there might be duplicates.
<adam12> AndreYuhai: Is this any more than words.sort.group_by(&:itself).values
<adam12> Without seeing expected output it's hard to guess.
nicholaslyang has quit [Client Quit]
<leftylink> sha256sum f481e5130198cea87511b000da295875550c216b64978c6c0d47b55d4c294611
<AndreYuhai> adam12, the expected output should be each words having the same characters grouped in the same array. But what I am asking is why in my code some of the words are grouped together even though they don't have the same chars
<AndreYuhai> I will share the outpu
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> AndreYuhai: Maybe words.map { |v| v.chars.sort.join }.group_by(&:itself).values
<adam12> AndreYuhai: Ahh. OK.
<adam12> AndreYuhai: I didn't mean to solve this for you :\
<AndreYuhai> adam12, oh no that's okay I couldn't solve it anyway. I just want to know what I did wrong. :D It already got me frustrated :D
<leftylink> and you can find out, by changing line 25 to `groups << [s, group]`
<leftylink> instead of `groups << group`
<leftylink> then you'll be able to look at any group that seems to be wrong, and ask why the words were included in the group
<AndreYuhai> leftylink, adam12 here: https://dpaste.org/rP73
<AndreYuhai> For example this is a group but what is wrong with this
<AndreYuhai> They are all different words
<AndreYuhai> but still in the same group
<leftylink> I repeat what I said above.
<leftylink> doing what I said will allow you to find out
<Iambchop> AndreYuhai: [yij, dji, yji, jij, iaj, xji, iij] <- iij
<AndreYuhai> Oh I will do that
Scient has quit [Quit: ZNC - http://znc.in]
Scient has joined #ruby
<AndreYuhai> Iambchop, I didn't get what that means sorry my brain can't process anything now. :D
<leftylink> I understand I'm being difficult, since my answer to "what is wrong?" has been "here's how you find out what is wrong" instead of "here is what is wrong", but for some reason I just didn't think saying "here is what is wrong" was the right move for this conversation. if you disagree, I apologise, let me know and I'll recuse myself from the conversation
<leftylink> I never mean to intentionally cause frustration so if I ever unintentionally do so I would like to apologise
<AndreYuhai> leftylink, oh no that's okay I was trying to do what you said but for some reason when I copy paste this code into pry it says groups can't be found haha
stryek has quit [Quit: Connection closed for inactivity]
<Iambchop> AndreYuhai: in the suggested [s, group] look at that group (it's near the end of the list, easier to find)
<Iambchop> (that group with the 'iig' I mean)
<AndreYuhai> Once I can run the code I shared, I will hahah.
Scient has quit [Ping timeout: 246 seconds]
drincruz has quit [Ping timeout: 265 seconds]
<adam12> AndreYuhai: I figured it out but I don't really have an answer for you...
<adam12> Actually
<adam12> I lie
<adam12> It looks right but it's not. I see one error immediately.
<AndreYuhai> when I run it, what I get is: [["b", "b", "f"], ["bgf", "sbf", "fxb", "fyb", "bbf", "bfh", "bef", "bgf", "bmf", "bfy"]]
<AndreYuhai> So the s is ["b", "b", "f"]
<leftylink> cool
<AndreYuhai> and the words are whatever is left
<AndreYuhai> so how can this make (s - words.chars).empty?
<AndreYuhai> I don't get what's wrong with my code
<leftylink> so let's see why bgf gets included in the ["b", "b", "f"] group huh
<leftylink> words.chars would be ["b", "g", "f"] would it not?
<AndreYuhai> yes
<AndreYuhai> and s - word.chars would not be empty in that case
<leftylink> &>> ["b", "b", "f"] - ["b", "g", "f"]
<rubydoc> # => [] (https://carc.in/#/r/9que)
<AndreYuhai> ooooooooh
kent\n has quit [Quit: going offline a few days for house fumigation]
<AndreYuhai> So I didn't know how that works then
<AndreYuhai> I thought it would return g
<AndreYuhai> Sad
Swyper has quit [Read error: Connection reset by peer]
<Iambchop> not sad; that's a reasonable guess
TCZ has quit [Ping timeout: 264 seconds]
Swyper has joined #ruby
<Iambchop> for that ooeration w/o knowing
<Iambchop> and now you know :-)
<AndreYuhai> But there is a method that does it maybe? I am not sure but I kind of remember you could do it both ways
<AndreYuhai> And I spent more than an hour on this haha.
TCZ has joined #ruby
Mia has quit [Read error: Connection reset by peer]
<AndreYuhai> anyway thank you all Iambchop adam12 leftylink for helping me find out what was wrong. :)
<leftylink> well, it is easy to agree that ["b", "g", "f"] - ["b", "b", "f"] == ["g"]. I am strictly just answering the question of whether that was possible, with no particular comment on whether it is the way to go for this problem
gueorgui has joined #ruby
<leftylink> I need to make a habit of saying such a comment both when it is and when it is not the way to go, otherwise it's a tell for whether it actually is if I only say it in one of the two situations
<AndreYuhai> leftylink, I didn't know about group_by either. I guess group_by { |w| w.chars.sort } would easily solve this. Not sure though whether that takes char count into account as well
<adam12> tbh I'm surprised subtracting the arrays didn't work, but in all honestly I'm not sure I've ever had to try.
gueorgui_ has quit [Ping timeout: 260 seconds]
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Client Quit]
<AndreYuhai> I just thought it would work and didn't even try it on pry to see what it does. I think I was so sure that it does what I thought it would ahaha. But it didn't ¯\_(ツ)_/¯
jenrzzz has quit [Ping timeout: 260 seconds]
bamdad has quit [Ping timeout: 240 seconds]
bamdad has joined #ruby
s3nd1v0g1us has joined #ruby
<leftylink> happened to me many times!
<leftylink> the problem being in somewhere where I hadn't suspected it to be
akem has joined #ruby
<leftylink> usually I'll have a good sense of where I *expect* the problem to be. and then sometimes the expectations are right. but sometimes they are wrong
<leftylink> gotta reevaluate those expectations sometimes I guess
akem_ has quit [Ping timeout: 260 seconds]
drincruz has joined #ruby
<AndreYuhai> I was printing all the groups but couldn't figure out why it was wrong. Never thought about the "-" operator so I wasted my time printing stuff and then it got me frustrated so I asked it here and thanks to you all, now I know what exactly "-" operator does. :D
<leftylink> &ri Array#-
s3nd1v0g1us has quit [Quit: WeeChat 2.8]
s3nd1v0g1us has joined #ruby
<AndreYuhai> Oh yes I've checked it later. group_by as well.
<AndreYuhai> I better get some sleep since it's around 3 am here. Have a nice day all! Thanks for all the help.
AndreYuhai has quit [Quit: Leaving]