havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3 | Can't talk? Register/identify with NickServ
coniptor has joined #ruby
coniptor has quit [Ping timeout: 256 seconds]
stdedos has quit [Quit: Connection closed]
drincruz has quit [Ping timeout: 264 seconds]
dfucci has joined #ruby
r29v has joined #ruby
coniptor has joined #ruby
dhollinger has joined #ruby
sagax has quit [Quit: Konversation terminated!]
baojg has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 256 seconds]
baojg has joined #ruby
bambanx has quit [Ping timeout: 264 seconds]
CommunistWolf has quit [Ping timeout: 260 seconds]
coniptor has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 240 seconds]
CommunistWolf has joined #ruby
r29v has quit [Quit: r29v]
jottr has joined #ruby
hassox has quit [Ping timeout: 244 seconds]
hassox has joined #ruby
kent\n has quit [Quit: No Ping reply in 180 seconds.]
kent\n has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
coniptor has joined #ruby
gix- has quit [Ping timeout: 240 seconds]
moldorcoder7 has quit [Ping timeout: 265 seconds]
jottr has joined #ruby
evdubs_ has joined #ruby
Sisyphus_ has joined #ruby
Sisyphus_ has quit [Client Quit]
evdubs has quit [Ping timeout: 264 seconds]
mattinto has joined #ruby
jottr has quit [Ping timeout: 264 seconds]
moldorcoder7 has joined #ruby
dfucci has joined #ruby
meinside has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
jottr has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
jdeen has joined #ruby
mattinto has quit [Ping timeout: 265 seconds]
jottr has joined #ruby
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jottr has quit [Ping timeout: 240 seconds]
evdubs_ is now known as evdubs
jdeen has joined #ruby
Swyper has quit [Remote host closed the connection]
jottr has joined #ruby
tempate has quit [Quit: ZNC 1.7.2 - https://znc.in]
tempate has joined #ruby
tempate has quit [Changing host]
tempate has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 244 seconds]
jottr has quit [Ping timeout: 265 seconds]
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dfucci has joined #ruby
rmnull has joined #ruby
zacts has joined #ruby
cloud69 has joined #ruby
znz_jp has quit [Quit: kill -QUIT $$]
dfucci has quit [Ping timeout: 260 seconds]
znz_jp has joined #ruby
rmnull has quit [Quit: WeeChat 3.0]
jdeen has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dfucci has joined #ruby
donofrio has quit [Remote host closed the connection]
akem has quit [Ping timeout: 256 seconds]
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jdeen has joined #ruby
Furai has quit [Quit: WeeChat 3.0]
orbyt_ has joined #ruby
Furai has joined #ruby
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jottr has joined #ruby
jdeen has joined #ruby
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jottr has quit [Ping timeout: 240 seconds]
cthu| has quit [Ping timeout: 246 seconds]
blackmesa1 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa1 has quit [Ping timeout: 240 seconds]
ChmEarl has quit [Quit: Leaving]
jottr has joined #ruby
blackmesa1 has joined #ruby
fercell has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
sagax has joined #ruby
vondruch has joined #ruby
jottr has joined #ruby
jottr has quit [Ping timeout: 272 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
maryo has joined #ruby
mcr has quit [Ping timeout: 246 seconds]
mcr has joined #ruby
royo25 has joined #ruby
<tempate> Hello. I have an array I want to go through n elements at a time. In C++ I would just write: for (int i = 0; i < a.size(); i += n); but in Ruby I'm not sure.
blackmesa1 has quit [Ping timeout: 256 seconds]
<leftylink> so I guess you can take the first element of each_slice. or you can generate the indices you want with (0..) % 2 or something
<leftylink> pinkpandabot: rb ((0..) % 2).take(5)
<pinkpandabot> [0, 2, 4, 6, 8] - https://carc.in/#/r/a1i2
<leftylink> so those are the two most obvious options I see for how to do that
<tempate> Hmmm
<tempate> I'm getting an error in the (0..) % 2 part
<tempate> I guess it's because Ruby 2.5 again?
<leftylink> well, it has been discussed before that endless ranges only work in 2.6+, so it is as true now as it was back then
postmodern has quit [Quit: Leaving]
<tempate> Yes, in view of that I tried doing (0..-1) % 2 but nothing
<tempate> I'll go with the each_slice way
<leftylink> one would think that would work, because array[0..-1] gives a productive result. but whether that works would quite depend on whether the array indexing knows to deal with it... in fact, maybe the array indexing never even gets to see the range and all it sees is an empty sequence
<leftylink> ooh
<leftylink> actually this thing doesn't even work anyway
<leftylink> &>> [1, 2, 3, 4, 5, 6, 6][(0..) % 2]
<leftylink> pinkpandabot: rb [1, 2, 3, 4, 5, 6, 6][(0..) % 2]
<pinkpandabot> stderr: -e:2:in `<main>': no implicit conversion of Enumerator::ArithmeticSequence into Integer (TypeError) - exit 1 - https://carc.in/#/r/a1i3
<leftylink> yeah so... it's gonna have to be each_slice. of course, one could just say array.size there
<leftylink> but at that point I think each_slice looks nicer
<leftylink> oh wait
<leftylink> you couldn't do that anyway
<havenwood> leftylink: That code does work in 3.0.
<leftylink> whoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<leftylink> that sounds really cool
<havenwood> leftylink: #=> [1, 3, 5, 6]
<leftylink> amusing that I typo'd the 7 into a 6 btw
<leftylink> well I am looking forward to that working
<tempate> Thank you very much for the help, leftylink
<havenwood> leftylink: Or `0.step(by: 2)` or `(0..).step(2)` or other Enumerator::ArithmeticSequence work too.
<havenwood> [*1..100][3.step(by: 5, to: 30)] #=> [4, 9, 14, 19, 24, 29]
<tempate> That's cool
<havenwood> [*1..100][(3..30) % 5] #=> [4, 9, 14, 19, 24, 29]
<havenwood> [*'a'..'z'][(0..) % 7].join.next.next.next #=> "ahoy"
<havenwood> [*'a'..'z'][0.step by: 12].join.capitalize #=> "Amy"
<tempate> It's not possible to evaluate a boolean expression to 0 or 1 without branching, right?
<leftylink> well strictly speaking a hash lookup isn't branching, but that's the letter of the questoin not the spirit
<leftylink> nobody would choose to do the hash lookup rather than the ternary probably
<tempate> Alright
<jhass> thing is Bool is i1 in LLVM IR, but no such thing as a number type in crystal, so what would you cast it to without garbage data following
jdeen has joined #ruby
<jhass> so https://carc.in/#/r/a1i6 but just use branching and don't trust this to not return garbage sometimes
<jhass> oh wait, I'm in the wrong channel :D
<jhass> nvm me :D
<leftylink> but also let me mention
<leftylink> if we're just doing arr.each { count += (thing ? 1 : 0) }, we should instead do count += arr.sum { thing }
<leftylink> er, no
<leftylink> if we're just doing arr.each { count += (thing ? 1 : 0) }, we should instead do count += arr.count { thing }
<leftylink> then no conversion from bool to int is necessary at all
<jhass> definitely, there's usually a way around it
rapha has joined #ruby
<rapha> hi all!
<rapha> does Ruby have something maintained that is similar to https://github.com/MeirKriheli/python-bidi , or is the version-0.0.2-4-years-old-https://github.com/elad/ruby-bidi the only such thing?
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
blackmesa1 has joined #ruby
<rapha> found https://github.com/waiting-for-dev/string-direction/ , too, which is passive only, though. i.e. it doesn't allow taking a character stream and turning it into something where both, the ltr and the rtl portions are legible.
siaw23 has joined #ruby
stdedos has joined #ruby
zacts has quit [Quit: leaving]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
royo25 has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
jottr has quit [Ping timeout: 260 seconds]
<leftylink> hmm
<leftylink> I very often do `things.to_h { |x| [x, f(x)] }` - I would appreciate if there were something to make that easier
<leftylink> then I'd be able to do uh... I dunno, things.to_h_k(&method(:f)) and have it work like the above
<leftylink> perhaps this usage pattern is not considered frequent enough
<leftylink> I could write it as things.to_h { |x| [x, x] }.transform_values(&method(:f)) but I'm not sure I like that
<leftylink> nah, I don't like that
<leftylink> I'll just do things.to_h { |x| [x, f(x)] }, it's straightforward
akem has joined #ruby
royo25 has joined #ruby
<yxhuvud> considering that to_h is like a year or two old, consider how it was before it was introduced :)
<yxhuvud> (ie to_h with a block. The regular one is of course older)
howdoi has quit [Quit: Connection closed for inactivity]
stdedos has quit [Quit: Connection closed]
jdeen has joined #ruby
baojg_ has joined #ruby
jottr has joined #ruby
royo25 has quit [Remote host closed the connection]
royo25 has joined #ruby
baojg has quit [Ping timeout: 264 seconds]
jdeen has quit [Quit: Textual IRC Client: www.textualapp.com]
<rapha> leftylink: you're not the only one doing a lot of that
vondruch has quit [Ping timeout: 256 seconds]
Rounin has quit [Ping timeout: 260 seconds]
<rapha> sooooo if y'all had a string which may or may not contain a mixture of, say, english, latin, hebrew, old greek, malayalam, arabic and for good measure, a couple of smileys, and all the characters, whether correctly or incorrectly so, just come one after the other, and there were no unicode-direction markers (yet) in that string, you'd roll your own algo to make an array out of appropriately reversed-or-not
<rapha> substrings out of that?
* rapha is a little disappointed that ruby, of all languages, might not have some built-in way of dealing with such a basic premise of human scripts
Rounin has joined #ruby
<jhass> rapha: mmh, if it doesn't need to be super performant, Regexp has these handy "unicode character properties" I'd check if I can't find one that is close enough or at least if you can't find one for each script (you care about), then .scan out each substring for that or something, or maybe you can even just .gsub in the direction markers
<jhass> but then I haven't seen a string with mixed direction scripts in it render properly anywhere yet
stanrifkin has joined #ruby
<jhass> maybe you can find a gem which maps out ranges for the bidi character properties
<jhass> then you chould .chunk the .codepoints according to that
<rapha> all of these fall under "roll your own"
<jhass> well yeah
<rapha> my fear is that there's too many little details to know and keep in mind
<jhass> I don't think it's a particularly common usecase
<rapha> i guess in that case i'll just stick to the Python thing with this, for now
<jhass> after all the purpose of the direction markers is to override the standard properties of the characters
<rapha> well, in this case, the usecase is to extract bidi texts out of PDFs
<jhass> so annotating the substrings with direction markers matching their inherent character properties is pretty redundant
<stanrifkin> can you name me a good introductory ruby book for an experienced perl/c++ programmer?
<rapha> (where you only have the x-y-coordinates, and then a pdf-reading library, that, hopefully, if you're real lucky, has already formed words, lines and paragraphs out of these x-y-coordinates for you
<rapha> )
<jhass> might not be the best introductionary topic though :D
vondruch has joined #ruby
<rapha> An experienced Perl and C++ programmer might be able to handle it, no idea though :P
<rapha> How up-to-date is the non-free version of https://learnrubythehardway.org/book/ ?
<stanrifkin> eloquent ruby?
<jhass> no idea, but then Ruby didn't change in a major way in the last decade almost. I wouldn't learn with a resource for 1.8 but even 1.9.3 stuff still largely applies today. The big features since are keyword arguments and refinements, with the latter being barely used
<jhass> I never read it but I got the design patterns book by the same author, good stuff
<jhass> heard good things about eloquent ruby too
<jhass> just use the Ruby 2.7 stdlib docs alongside to discover what's new and shiny :)
<stanrifkin> i liked this impatient java series by cay horstmann. i'll try eloquent ruby first.
gigetoo has joined #ruby
<stanrifkin> this russ olsen writes about clojure too. that is strange :)
<rapha> eloquent ruby, isn't that from 2011?
<stanrifkin> yes
<rapha> it seems that there's quite a few people who enjoy both ruby and clojure, for some reason
* rapha is kind of glad that he began learning Ruby when The Pickaxe was still recent-ish
<stanrifkin> i read it now... first paragraph talks about indentation :(
<rapha> lol
<jhass> two spaces!
<rapha> my first programming teacher was a mathematician who began the first lesson by saying "i'm looking forward to learning a lot from you. usually that starts being the case 3 weeks into the class"
<rapha> and yes, he thought indentation was vanity
<rapha> and yes, he wore sandals, lumberjack shirts and had white hair on his head and in his face
<stanrifkin> my prof (c++ expert) wrote everytime he multiplied matrices cascaded for loops.... instead of making a matrix type
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rapha> hopefully your prof can tell C and C++ apart from one another, at least, stanrifkin?
<stanrifkin> i dont think so... but he knew documentation. how to export latex to websites etc...
royo25 has quit [Ping timeout: 240 seconds]
royo25 has joined #ruby
<stanrifkin> so @var are normal member variables and @@var are static variables?
<stanrifkin> why use each instead of for?
<jhass> yes, we call them @instance_variables and @@class_variables. Stay away from @@class_vars, they have some unobvious behaviours around inheritance and there's almost always better alternatives
<jhass> .each as the base interface means you can just include Enumerable and get tons and tons of convenience sugar on top
<jhass> to this point calling .each actually become comparably rare, at least to where you would reach for for loops in other languages
<jhass> and then it would be alien to use for loops for the few cases where you still want to just iterate over the plain collection, especially with all the block based things around it
<jhass> finally .each has the scoping you expect from other languages for loop constructs, for however does not enter a new scope
meinside has quit [Quit: Connection closed for inactivity]
<stanrifkin> then if ... end does not make a new scope either?
<jhass> yes
cd has quit [Quit: cd]
<stanrifkin> more confusing than perl :)
<jhass> not so confusing if you practice the hygiene of keeping your methods small, and saves declaring variables beforehand :)
<jhass> it's a little more nasty with for IMO, since there you always go the loop variable polluting your current scope
<jhass> *got the
jenrzzz has quit [Ping timeout: 265 seconds]
Nahra has joined #ruby
donofrio has joined #ruby
dviola has joined #ruby
baojg_ has quit [Remote host closed the connection]
baojg has joined #ruby
lucasb has joined #ruby
drincruz has joined #ruby
<stanrifkin> should i install rbenv?
jenrzzz has joined #ruby
<nakilon> rbenv is good
tekk has quit [Ping timeout: 256 seconds]
<jhass> it doesn't matter too much, rvm is the most bulky but also "run and forget" one. chruby is the most "stay out of my way" one. rbenv is sorta in between with some design choices which are very ymmv
tekk has joined #ruby
<jhass> if it's newer than say 2.3 your system ruby is perfectly fine for learning
jdeen has joined #ruby
<stanrifkin> i use perlbrew for perl....
<stanrifkin> ok. i use the system ruby
Rudd0 has quit [Remote host closed the connection]
DTZUZU has joined #ruby
DTZUZU_ has quit [Read error: Connection reset by peer]
maryo has quit [Quit: Leaving]
<stanrifkin> i need local documentation from terminal
royo25 has quit [Remote host closed the connection]
royo25 has joined #ruby
<stanrifkin> ruby even has got pack unpack functions - thats nice
<stanrifkin> i found ri
<stanrifkin> but nothing is showing
<stanrifkin> do i miss some packages?
HappyGirl has quit [Quit: BitchX Official IRC Channel -- #BitchX on EFNet]
<stanrifkin> missed ruby2.7-doc package. now it works
stdedos has joined #ruby
royo25 has quit [Quit: Bye]
drincruz has quit [Ping timeout: 246 seconds]
stdedos has quit [Quit: Connection closed]
<stanrifkin> no ++ operator.... aua
baojg has quit [Remote host closed the connection]
<jhass> Enumerable#count covers most of its usecases :)
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
drincruz has joined #ruby
TCZ has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 256 seconds]
sagax has quit [Read error: Connection reset by peer]
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
Swyper has quit [Ping timeout: 264 seconds]
xrlabs_ has joined #ruby
xrlabs_ has quit [Client Quit]
xrlabs has joined #ruby
mwlang has joined #ruby
jenrzzz has joined #ruby
<mwlang> I’m testing Ruby 3.0.0-preview1 and one of my test suites where I’m testing JSON parsing is failing. The weird thing is it’s failing in the json 2.0.4 gem with “wrong number of arguments (given 2, expected 1), but in my gemspec, I specify ‘~> 2.3.0` and verified that’s what bundler resolves to. Any idea how I could be hitting an older gem version? I can’t seem to uninstall it, at least with the normal approaches and not even s
<mwlang> where 2.0.4 came from since it’s apparently not a dependency of any of the gems in my dependency list.
jdeen has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
<mwlang> not expecting a real solution/answer to this one, but hoping someone can give me some ideas on a debugging strategy to track this one down.
drincruz has quit [Ping timeout: 272 seconds]
xiq has joined #ruby
drincruz has joined #ruby
<leah2> print $LOAD_PATH
lightstalker has quit [Ping timeout: 256 seconds]
lightstalker has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
<mwlang> hmmm… thanks, @leah2 I didn’t expect that to be illuminating, but json-2.0.4 is certainly in that list.
<leah2> did you run bundle install?
<leah2> or upgrade? hm
<mwlang> yeah.
<mwlang> just also added the bundle list to that gist.
<mwlang> clearly, the json bundle lists and what’s in the load path diverge.
<leah2> weird, yes
<leah2> i dunno enough about bundler to help, sorry
<mwlang> that’s ok. it’s further along the sleuthing path than I was earlier.
jottr has quit [Quit: WeeChat 3.0]
jottr has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
<adam12> mwlang: Almost sounds like bundler isn't modifying the load path. How are you running your test suite?
Swyper has joined #ruby
<mwlang> the typical bundle exec rake test way
<adam12> mwlang: can you print $LOAD_PATH at the top of your test file? or test helper?
greengriminal has joined #ruby
<adam12> mwlang: Or is that one in your gist the one you did?
<mwlang> that’s what I did. I actually printed it in the rescue block of the test that fails.
jenrzzz has joined #ruby
<mwlang> @adam12 you hit the nail on the head with that observation about bundler.
<mwlang> The test suite is running “mini-environments” like the appraisal gem does…it’s _that_ environment that’s bundling json while I was trying to debug the bundle environment that launches the tests.
<rapha> stanrifkin: rvm/rbenv used to be "necessary" for a while, but Ruby is quite a bit further along the way than Python, imho. Nowadays the only place where I need rbenv is an old web server VM serving a bunch of legacy Rails apps. Everywhere else, the system Ruby works just fine and makes for a much easier life. Wouldn't want to live without rake anymore, though. Basically, everything that doesn't have special
<rapha> requirements that preclude doing so, ends up as a Rakefile or a Rakefile plus a bunch of .rake files.
<rapha> As for pack/unpack, I believe we have Perl to thank for those :)
<rapha> Oh, yeah, and Bundler. Also much beloved.
lucasb has quit [Quit: Connection closed for inactivity]
siaw23 has quit [Read error: Connection reset by peer]
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 244 seconds]
ChmEarl has joined #ruby
mwlang has quit [Quit: mwlang]
al2o3-cr has joined #ruby
Rudd0 has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
solars has quit [Quit: Connection closed for inactivity]
Caerus has quit [Ping timeout: 256 seconds]
xrlabs has quit [Quit: Connection closed for inactivity]
Caerus has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
sagax has joined #ruby
wimpog has joined #ruby
<wimpog> Hello How do I change the execution timeout? I believe it is 60 seconds by efault
rikkipitt has joined #ruby
Swyper has quit [Remote host closed the connection]
rikkipitt has quit [Client Quit]
jenrzzz has joined #ruby
drincruz_ has joined #ruby
phaul has joined #ruby
rubydoc has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
blackmesa1 has joined #ruby
<adam12> wimpog: Ruby itself has no execution timeout. Is this for a web server? or a job queue? or?
vondruch has quit [Read error: Connection reset by peer]
<wimpog> adam12: Puma
<havenwood> ?crosspost wimpog
<wimpog> havenwood: yes
cthu| has joined #ruby
orbyt_ has joined #ruby
<rapha> havenwood: is that a bot command?
jordanm has quit [Remote host closed the connection]
<jhass> it should be...
arahael1 has joined #ruby
<jhass> ?ping
<jhass> Maybe I'll just configure it to reboot every 24h
arahael has quit [Ping timeout: 256 seconds]
stanrifkin has quit [Quit: Leaving]
cloud69 has quit []
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
bambanx has joined #ruby
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
ruby[bot] has quit [Remote host closed the connection]
cek has joined #ruby
ruby[bot] has joined #ruby
<jhass> ?ping
<ruby[bot]> pong
cek has left #ruby [#ruby]
jenrzzz has quit [Ping timeout: 256 seconds]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 264 seconds]
TCZ has quit [Remote host closed the connection]
jenrzzz has joined #ruby
moldorcoder7 has quit [Read error: Connection reset by peer]
moldorcoder7 has joined #ruby
jordanm has joined #ruby
Swyper has quit [Remote host closed the connection]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<jhass> >> RUBY_VERSION
<ruby[bot]> jhass: # => "2.7.0" (https://carc.in/#/r/a1nq)
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
jdeen has joined #ruby
fercell has quit [Quit: WeeChat 2.9]
jinie has quit [Quit: ZNC 1.8.2 - https://znc.in]
jinie has joined #ruby
jdeen has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jdeen has joined #ruby
howdoi has joined #ruby
<rapha> >> 1+1
<ruby[bot]> rapha: # => 2 (https://carc.in/#/r/a1p6)
<rapha> :)
<rapha> >> 'hooray! '*5+'work finally over!'
<ruby[bot]> rapha: # => "hooray! hooray! hooray! hooray! hooray! work finally over!" (https://carc.in/#/r/a1p7)
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 260 seconds]
<rapha> weird ppl ... program ruby all they, then sit on the tram back home and just keep going
jdeen has quit [Quit: Textual IRC Client: www.textualapp.com]
postmodern has joined #ruby
blackmesa has joined #ruby
Swyper has quit [Remote host closed the connection]
TCZ has joined #ruby
Swyper has joined #ruby
ellcs has joined #ruby
Swyper has quit [Ping timeout: 264 seconds]
al2o3-cr has quit [Quit: WeeChat 2.9]
al2o3-cr has joined #ruby
zacts has joined #ruby
poguez_ has joined #ruby
Nahra has quit [Quit: leaving]
roshanavand has joined #ruby
greengriminal has quit [Read error: Connection reset by peer]
roshanavand has quit [Ping timeout: 265 seconds]
roshanavand has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 265 seconds]
crankharder has joined #ruby
<crankharder> I'm trying to silence BigDecimal#new's (ruby 2.6.3) deprecation warning by monkeypatching initialize which, um, isn't playing nice. can initialize be monkeypatched? any other ideas to silence this specific warning?
BTRE has quit [Remote host closed the connection]
<jhass> def silence_warnings; $stderr = File.open("/dev/null"); yield; ensure; $stderr = STDERR; end
pinkpandabot has quit [Quit: write?]
<crankharder> er, well yea, ruby provides silence_warnings - i dont need to build that. need to get it injected into BigDecimal
<jhass> oh it does these days? TIL :D
<crankharder> er, rails does - sorry. original question was about how to get whatever silence hackery into BigDecimal
<jhass> mmh, just class BigDecimal; def self.new!; silence_warnings { new } end end; and replace all callsides?
<crankharder> new! with a bang?
<jhass> random name
<jhass> def self.make, def self.create; whatever floats your boat
duderonomy has joined #ruby
<crankharder> it's not whatever floats my boat - i'm specifically trying to monkey patch new. opening BigDecimal and attempting to redefine new and/or initialize is not playing nice. class BigDecimal ; def self.new(*args) ; puts 123 ; super ; end ; end -> "wrong number of arugments given 1 expected 0" - i get similar errors monkey patching initialize
<crankharder> leads me to believe initialize/new are somehow special
<adam12> crankharder: What version of bigdecimal? `gem list bigdecimal`
<crankharder> 1.4.1
ellcs has quit [Ping timeout: 240 seconds]
<adam12> crankharder: Are the warnings coming from an app of yours, or?
<crankharder> not our app, rails or gems we can't upgrade immediately
gix has joined #ruby
<adam12> crankharder: Ah. Well in that case I might see if I can use ruby-warning gem and not monkeypatch.
<adam12> but patching self.new seems to work fine here. Can you show what you tried?
deadbee has joined #ruby
<crankharder> already did a few lines above
<adam12> Oh I see.
<adam12> Dont' call super
<adam12> call BigDecimal(*args)
<crankharder> ah, ok
<crankharder> i wonder why super doens't work though
<adam12> crankharder: Because it calls the original `new` method, which has the warning.
<crankharder> no, it throw that error above
<crankharder> hadn't gotten to silence the warning in my example above. that's besides the point
<adam12> crankharder: My guess is that it's because `new` is implemented in C for that specific class, but I don't remember the exact nuances of monkeypatching `new`.
kristian_on_linu has joined #ruby
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 260 seconds]
roshanavand_1 has joined #ruby
roshanavand_1 is now known as roshanavand
roshanavand_ has quit [Ping timeout: 272 seconds]
<crankharder> good stuff - thanks for the help!
zacts has quit [Quit: leaving]
deadbee has quit [Quit: WeeChat 2.9]
sagax has quit [Remote host closed the connection]
<wimpog> adam12: hi
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
wimpog has quit [Quit: wimpog]
arahael1 is now known as arahael
oneeggeach has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
oneeggeach has quit [Client Quit]
orbyt_ has joined #ruby
Technodrome has joined #ruby
ghormoon has quit [Ping timeout: 264 seconds]
ghormoon has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
blackmesa has joined #ruby
aremaref has joined #ruby
<aremaref> i'm trying to monkeypatch the request method for the HTTPClient gem but am not sure why it's not working: https://dpaste.org/NLFZ
blackmesa has quit [Ping timeout: 244 seconds]
<aremaref> I put an exception to try and debug but it doesn't seem to get hit
AndyC has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
<aremaref> Nevermind, Spring issues :(
baojg_ has joined #ruby
baojg has quit [Ping timeout: 264 seconds]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 272 seconds]
roshanavand_ is now known as roshanavand
crankharder has joined #ruby
bambanx_ has joined #ruby
bambanx has quit [Ping timeout: 272 seconds]