« Back to channel list

#ruby - 06 June 2018

« Back 1 day Forward 1 day »
[00:07:35] Lytol: has joined #ruby
[00:07:38] ramfjord: has joined #ruby
[00:12:33] Dark_Arc: has joined #ruby
[00:13:52] ramfjord: has joined #ruby
[00:14:13] banisterfiend: has joined #ruby
[00:14:44] cliluw: has joined #ruby
[00:15:29] PhiSyX: has joined #ruby
[00:15:47] pabs: has joined #ruby
[00:17:18] jrm: has joined #ruby
[00:22:52] ramfjord: has joined #ruby
[00:30:31] ciscam: has joined #ruby
[00:31:14] nicht: has joined #ruby
[00:31:20] nicht_: has joined #ruby
[00:33:38] eelster: has joined #ruby
[00:38:20] x71e6fd52: has joined #ruby
[00:39:44] jenrzzz: has joined #ruby
[00:39:44] jenrzzz: has joined #ruby
[00:43:11] pabs: has joined #ruby
[00:48:17] glisignoli: has joined #ruby
[00:51:30] tdy: has joined #ruby
[00:53:58] ramfjord_: has joined #ruby
[00:59:16] dreamthese: has joined #ruby
[01:07:01] gizmore: has joined #ruby
[01:10:25] pabs: has joined #ruby
[01:14:44] BlopMonster: has joined #ruby
[01:16:14] jrafanie: has joined #ruby
[01:20:27] t0xik: has joined #ruby
[01:25:21] eelster: has joined #ruby
[01:42:26] ramfjord: has joined #ruby
[01:46:59] lxsameer: has joined #ruby
[01:48:23] ramfjord: has joined #ruby
[01:50:19] akaiiro: Spiker01 It seems that you need to set some configuration values for the theme you're using. Refer to the theme docs.
[01:51:36] Jiaoyin: has joined #ruby
[01:51:52] Jiaoyin: How is it that in the IRB when I put down........
[01:51:53] Jiaoyin: puts Piglet.new.speak || "Hello World"
[01:52:12] Jiaoyin: it pops out "speak" and then "Hello World"
[01:52:19] gil_: has joined #ruby
[01:52:19] gil_: has joined #ruby
[01:52:20] Jiaoyin: what does the || represent?
[01:55:31] ramfjord: has joined #ruby
[02:00:25] havenwood: Jiaoyin: It means "or". In your example if `Piglet.new.speak` returns `nil` or `false` then it'll print "Hello world".
[02:01:28] ramfjord: has joined #ruby
[02:01:36] havenwood: >> 'Jiaoyin' || 'never gunna happen since it was not nil or false to the left'
[02:01:37] ruby[bot]: havenwood: # => "Jiaoyin" (https://eval.in/1015726)
[02:02:04] havenwood: >> false || 'Jiaoyin'
[02:02:05] ruby[bot]: havenwood: # => "Jiaoyin" (https://eval.in/1015727)
[02:12:39] Spiker01: akaiiro this theme dont worked in my PC. I read doc http://idratherbewriting.com/documentation-theme-jekyll/ but still it does not work, jekyll does not startю
[02:17:37] akaiiro: Spiker01 Try to follow the steps at section «4. Option 1: Build the Theme (without the github-pages gem)»
[02:18:53] alfiemax: has joined #ruby
[02:22:55] Spiker01: akaiiro I understood. I can not start jekyll serve, so the documents tell about Docker, I understood correctly?
[02:24:01] Spiker01: I have to use the Docker to run server.
[02:25:02] akaiiro: Spiker01 That is other option. I would try to use the software without that overhead first. Try removing the `Gemfile` and `Gemfile.lock` and runing `jekyll serve -w`
[02:25:22] orbyt_: has joined #ruby
[02:27:01] Spiker01: She dont running, bundle install ok, bundle update ok,bundle exec jekyll serve and jekyll serve -w errors
[02:27:11] lxsameer: has joined #ruby
[02:30:00] Spiker01: akaiiro https://gist.github.com/Spiker01/80ca4eccf1bb4f3aa1f30409377c0489
[02:30:35] halbbalda: has joined #ruby
[02:33:15] safetypin: has joined #ruby
[02:33:28] akaiiro: Spiker01 Then, edit the Gemfile. Remove the `
[02:33:29] akaiiro: gem 'github-pages', group: :jekyll_plugins` line and run `bundle update`. Then, try running `bundle exec jekyll -w`.
[02:35:34] chamar: has joined #ruby
[02:38:34] Spiker01: akaiiro but, look at this: https://gist.github.com/Spiker01/970453d9c235d30fa298e74c703aacae
[02:39:00] chamar: has joined #ruby
[02:39:42] nicht_: has joined #ruby
[02:40:56] bmurt: has joined #ruby
[02:42:49] akaiiro: Spiker01 1) Don't run Bundler as root.
[02:43:41] akaiiro: Spiker01 2) The log days you're still `Using github-pages 186`
[02:46:56] Spiker01: akaiiro My Gemfile https://gist.github.com/Spiker01/260aebcbff0728dacb00951c03353fbc . Does not work correctly because of I run this command from under the root user?
[02:48:14] akaiiro: Spiker01 That is your Gemfile.lock
[02:48:49] khomesh24: has joined #ruby
[02:49:31] mrBen2k2k2k: has joined #ruby
[02:49:50] enot: has joined #ruby
[02:50:04] alfiemax_: has joined #ruby
[02:50:51] Spiker01: I did not understand what the second text point in your message. I use gems what is distributed with the theme design.
[02:55:14] Spiker01: akaiiro What should this gemfile.lock look like? Change as correctly.
[02:56:05] akaiiro: Spiker01You should not edit `Gemfile.lock`. Edit `Gemfile`.
[02:56:28] akaiiro: Spiker01 You should not edit `Gemfile.lock`. Edit `Gemfile`.
[03:00:10] cadillac_: has joined #ruby
[03:00:12] m27frogy: has joined #ruby
[03:00:35] Spiker01: akaiiro gemfile.lock file is never manually edited, only automaticall (rule)?
[03:02:21] akaiiro: Spiker01 Yes. `Gemfile.lock` is generated by bundler. Edit `Gemfile`, run `bundle install` and bundler will make the changes to `Gemfile.lock`
[03:03:53] darkhanb: has joined #ruby
[03:04:03] Jiaoyin: I'm trying to understand what chomp means....and what does it do
[03:04:18] amar: has joined #ruby
[03:04:25] havenwood: Jiaoyin: It eats the end of a string, *if* it like the taste.
[03:04:36] havenwood: &ri String#chomp
[03:04:51] Jiaoyin: what do you mean...."if" it likes the taste?
[03:05:29] havenwood: Jiaoyin: Have you read the docs?
[03:05:40] havenwood: Jiaoyin: https://ruby-doc.org/core/String.html#method-i-chomp
[03:06:23] Jiaoyin: yea, I did read it. I still don't it get. Does it act like /n
[03:07:00] lxsameer: has joined #ruby
[03:07:37] Jiaoyin: a sperator*
[03:08:12] havenwood: Jiaoyin: It's adopted from the Perl language. Check the value of: $/
[03:08:28] Jiaoyin: On the doc it says..
[03:08:29] havenwood: Jiaoyin: Here're the Perl docs: https://perldoc.perl.org/functions/chomp.html
[03:08:31] Jiaoyin: "hello".chomp #=> "hello" "hello\n".chomp #=> "hello" "hello\r\n".chomp #=> "hello"
[03:08:48] Jiaoyin: looking at it...it all looks the same to me
[03:09:15] havenwood: Jiaoyin: The first one is the same. The second one is missing the newline. The third one is missing the abomination of a Windows newline.
[03:09:36] havenwood: >> "Jiaoyin\n\n".chomp
[03:09:37] ruby[bot]: havenwood: # => "Jiaoyin\n" (https://eval.in/1015745)
[03:09:47] havenwood: Jiaoyin: ^ note one newline removed
[03:09:49] braincrash: has joined #ruby
[03:09:53] Spiker01: akaiiro https://gist.github.com/Spiker01/83758bc559c1d0113e083cd1097b9608
[03:10:05] enot: has joined #ruby
[03:11:25] havenwood: Spiker01: Don't delete the Gemfile. Do you know what a Gemfile does?
[03:12:16] havenwood: Jiaoyin: chomp is most often used to ensure that a trailing newline is removed
[03:12:51] akaiiro: @havenwood That is the advice from the theme's documentation
[03:13:09] havenwood: Jiaoyin: it can alternatively take an argument, but these days I'd use String#delete_suffix for that case
[03:13:20] havenwood: akaiiro: oh my! haha
[03:13:35] Spiker01: <havenwood> Yes, it contains lists of gems and "repositories".
[03:13:35] havenwood: ACTION reads the backlog
[03:16:10] Spiker01: <havenwood> I will be happy with your help. I'm trying to install the theme of Jekyll on the local PC. http://idratherbewriting.com/documentation-theme-jekyll/
[03:16:28] akaiiro: Spiker01 Good, you have Jekyll working. Now you have to fix the liquid syntax issue. That is likely because the theme is intended for an older version of Jekyll
[03:16:50] havenwood: Spiker01: It's very odd advice to delete the Gemfile, but I see that's exactly what the docs are saying!
[03:17:00] lxsameer: has joined #ruby
[03:17:20] havenwood: Spiker01: So your current issue is?: Unknown tag 'gist'
[03:17:53] havenwood: Spiker01: What's on line 43 of the _posts/2013-12-25-block.md file?
[03:18:40] zhangkaizhao: has joined #ruby
[03:18:59] Spiker01: havenwood I understand that this docs should not be run jekyll on the standard server - incompatibility of plugins. Did he understand correctly?
[03:19:14] havenwood: Spiker01: Seems like akaiiro has a better idea than me what's going on. :-)
[03:19:26] Robbie: has joined #ruby
[03:20:38] Spiker01: havenwood point 4 on this docs site tells about it.
[03:20:55] Robbie: has joined #ruby
[03:22:25] Spiker01: <havenwood> You have ever used Jekyll?
[03:24:01] Eiam: has joined #ruby
[03:26:03] akaiiro: Spiker01 https://github.com/jekyll/jekyll/issues/3906#issuecomment-201454567 That is what I found searching your error
[03:26:16] akaiiro: Good luck with that!
[03:27:13] lxsameer: has joined #ruby
[03:28:24] Spiker01: <akaiiro> thank you for this link.
[03:34:07] Spiker01: I read it, but there is no solution to the problem. Maybe I'll try using another site generator.
[03:36:05] Autolycus: has joined #ruby
[03:37:19] alfiemax: has joined #ruby
[03:37:25] Spiker01: I liked that the Jekyll has a lot of plug-ins. But now I realized that plug-ins have a compatibility issue because developers (probably) do not support backward compatibility. New plugins are not supported by the old plugins, even if they are dependent on each other.
[03:37:59] Spiker01: In the future, this can cause a support problem.
[03:39:04] gix-: has joined #ruby
[03:47:33] pabs: has joined #ruby
[03:48:08] nicht_: has joined #ruby
[03:52:36] dinfuehr: has joined #ruby
[03:54:52] BlopMonster: has joined #ruby
[03:56:04] sagax: has joined #ruby
[04:04:23] reber: has joined #ruby
[04:04:25] pabs: has joined #ruby
[04:07:04] lxsameer: has joined #ruby
[04:07:30] emilford: has joined #ruby
[04:08:19] mozzarella: has joined #ruby
[04:09:56] chamar: has joined #ruby
[04:25:30] nicht_: has joined #ruby
[04:25:53] nicht_: has joined #ruby
[04:31:03] howdoi: has joined #ruby
[04:35:25] alfiemax: has joined #ruby
[04:37:47] nicht_: has joined #ruby
[04:45:33] Haris: has joined #ruby
[04:45:35] Haris: hello all
[04:45:56] Haris: I'm trying to configure a ruby based project i.e., redmine. I'm getting an error that doesn't make sense
[04:46:06] Haris: correction, that's yaml issue
[04:46:32] ramfjord: has joined #ruby
[04:47:33] Haris: thanks all
[04:47:34] Haris: has left #ruby: ()
[04:51:15] apeiros: has joined #ruby
[04:52:03] lxsameer: has joined #ruby
[04:52:32] ur5us: has joined #ruby
[04:54:18] nicht_: has joined #ruby
[04:56:17] regedit: has joined #ruby
[04:57:36] regedit: i once came asking for a recommendation for an HTTP library, and was advised to use Typhoeus
[04:57:47] regedit: with its hydra parallel requests feature
[04:58:11] regedit: problem is - i now realize i want to make these HTTP requests from a Sidekiq worker....
[05:00:56] regedit: the sidekiq worker performs its task on 1 record at a time, rather than having all records to process and queue up for typhoeus http requests... so it seems i might be losing out on running many Typhoeus+hydra requests in parallel
[05:02:58] regedit: is there another way of queuing up many many requests for typhoeus in parallel from within workers that operate on only 1 record at a time?
[05:06:55] byte00: has joined #ruby
[05:08:17] cadillac_: has joined #ruby
[05:10:39] aufi: has joined #ruby
[05:12:31] havenwood: regedit: Yeah, I sometimes recommend Typhoeus, but not for use with Sidekiq. Consider HTTP.rb. See how a very basic setup performs before proceeding.
[05:13:09] havenwood: regedit: https://twin.github.io/httprb-is-great/
[05:14:13] havenwood: regedit: https://github.com/httprb/http#basic-usage
[05:18:29] Emmanuel_Chanel: has joined #ruby
[05:19:24] regedit: havenwood: so persistent http connection is not an applicable notion for me if my records are being processed 1 at a time in sidekiq workers?
[05:22:21] havenwood: regedit: Sidekiq ships with the connection_pool gem: https://github.com/mperham/sidekiq/blob/master/sidekiq.gemspec#L21
[05:22:27] havenwood: regedit: https://github.com/mperham/connection_pool
[05:22:48] ur5us: has joined #ruby
[05:23:08] havenwood: regedit: You might want to do the simplest thing that can possibly work, and see how that performs before proceeding with optimizations.
[05:24:43] nowhereman_: has joined #ruby
[05:26:18] anisha: has joined #ruby
[05:27:52] havenwood: regedit: That said, a pool of shared persistent connections makes sense to me as reasonable.
[05:29:48] chat_: has joined #ruby
[05:30:14] donofrio: has joined #ruby
[05:30:33] Radar: Is it still the cool thing to use the oj gem over the json stdlib package? (Ruby 2.4.2)
[05:36:36] apeiros: has joined #ruby
[05:42:52] jcalla: has joined #ruby
[05:47:03] lxsameer: has joined #ruby
[05:51:10] guacamole: has joined #ruby
[05:51:10] guacamole: has joined #ruby
[05:51:34] aupadhye: has joined #ruby
[05:53:16] ciscam: has joined #ruby
[05:53:27] sauvin: has joined #ruby
[05:53:57] havenwood: Radar: It seems they've closed the gap to the point where I don't bother.
[05:54:21] havenwood: Radar: It looks like Oj still has an edge loading: https://gist.github.com/havenwood/c4a9d527df030dfaab996d42f745600b
[05:55:03] havenwood: Radar: I'm curious as to memory usage difference, since JSON parser vary wildly.
[05:55:42] havenwood: Radar: This is a pretty good multi lang time/mem comparison: https://github.com/kostya/benchmarks#json
[05:57:31] havenwood: Radar: Or if speed matters, and you get to pick on both ends, MessagePack is way faster than JSON.
[05:58:02] Radar: We've already got JSON code that's using oj. I'm just having issues with the oj + envied gems on a new project and hoping to get rid of one of those two gems.
[05:58:18] Radar: Or I could investigate why the problem is happening in the first place?
[06:03:08] havenwood: Updated Gist with MsgPack just for fun. Seems about twice as fast.
[06:03:18] havenwood: Radar: I like stdlib JSON personally.
[06:03:51] havenwood: Radar: It's got nice C, Java and pure Ruby implementations. I think it's the most widely used, so seems to have the kinks worked out with best inter-gem compat.
[06:07:01] lxsameer: has joined #ruby
[06:08:29] aupadhye: has joined #ruby
[06:11:22] ellcs: has joined #ruby
[06:17:14] lxsameer: has joined #ruby
[06:21:21] roshanavand: has joined #ruby
[06:29:28] andikr: has joined #ruby
[06:33:00] raul782: has joined #ruby
[06:33:47] akaiiro: has joined #ruby
[06:35:58] raul782: has joined #ruby
[06:36:42] KeyJoo: has joined #ruby
[06:36:44] raul782: has joined #ruby
[06:36:55] amelliaa: has joined #ruby
[06:42:38] conta: has joined #ruby
[06:48:31] suukim: has joined #ruby
[06:55:31] mtkd: has joined #ruby
[06:55:50] alfiemax_: has joined #ruby
[06:55:51] yohji: has joined #ruby
[06:56:59] lxsameer: has joined #ruby
[06:57:47] aufi: has joined #ruby
[07:03:13] Asher: has joined #ruby
[07:03:32] schleppel: has joined #ruby
[07:05:00] raul782: has joined #ruby
[07:06:03] amar: has joined #ruby
[07:07:09] za1b1tsu: has joined #ruby
[07:09:06] alfiemax: has joined #ruby
[07:10:27] tAn: has joined #ruby
[07:11:28] biberu: has joined #ruby
[07:12:19] lxsameer: has joined #ruby
[07:12:56] chat: has joined #ruby
[07:24:38] leafyleong: has joined #ruby
[07:24:38] sysvalve: has joined #ruby
[07:28:51] clemens3: has joined #ruby
[07:41:03] zwelmi: has joined #ruby
[07:42:00] lxsameer: has joined #ruby
[07:42:03] zwelmi: i'd like to code a social graph and then render it visually in the browser. what's a good library for that? I just found this from 2009 https://github.com/chrislo/data_visualisation_ruby
[07:44:42] reber__: has joined #ruby
[07:51:05] reber: has joined #ruby
[07:51:58] lxsameer: has joined #ruby
[07:56:15] apeiros: has joined #ruby
[07:56:21] BlopMonster: has joined #ruby
[07:56:39] BaroMeter: has joined #ruby
[07:57:30] apeiros: has joined #ruby
[07:58:16] reber__: has joined #ruby
[07:59:01] kliq: has joined #ruby
[07:59:43] dionysus69: has joined #ruby
[08:00:21] akem2: has joined #ruby
[08:04:55] guille-moe: has joined #ruby
[08:12:53] arekushi: has joined #ruby
[08:20:38] armyriad: has joined #ruby
[08:25:23] zwelmi: has joined #ruby
[08:25:52] mlkkk: has joined #ruby
[08:26:29] amar: has joined #ruby
[08:29:17] byte00: has joined #ruby
[08:32:59] lxsameer: has joined #ruby
[08:36:19] dionysus69: has joined #ruby
[08:37:50] conta: has joined #ruby
[08:44:51] zwelmi: has joined #ruby
[08:51:24] Emmanuel_Chanel: has joined #ruby
[08:52:51] mtkd: has joined #ruby
[08:53:43] Emmanuel_Chanel: has joined #ruby
[08:53:47] Beams: has joined #ruby
[08:55:58] Emmanuel_Chanel: has joined #ruby
[09:03:04] trautwein: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[09:03:43] andikr: has joined #ruby
[09:05:14] venmx: has joined #ruby
[09:09:08] KeyJoo: has joined #ruby
[09:10:04] KeyJoo: has joined #ruby
[09:14:33] simmaniac: has joined #ruby
[09:15:08] syndikate: Why is there no specific ruby 2.4.1 docker image file in registry?
[09:15:15] za1b1tsu: has joined #ruby
[09:17:03] drale2k_: has joined #ruby
[09:17:50] apeiros: I suppose because nobody put one in?
[09:18:24] RougeR: has joined #ruby
[09:18:46] Mike11: has joined #ruby
[09:20:50] syndikate: Can I use 2.4.4 for a ruby app of version 2.4.1
[09:22:46] dminuoso: syndikate: Probably yes.
[09:22:54] dminuoso: But why dont you try it out
[09:23:08] dminuoso: If you have native extensions it depends on them.
[09:24:12] syndikate: Yeah, am trying it out now dminuoso
[09:24:22] syndikate: It's a simple rails app, I hope nothing breaks
[09:24:40] dminuoso: syndikate: You have a test suite, dont you?
[09:24:42] Charliebr73: has joined #ruby
[09:25:16] syndikate: dminuoso, Na, this is a scaffold app, my aim is to learn something else - so there is nothing in the app basically
[09:25:42] apeiros: syndikate: as of 2.1, a change in the third segment should not break your app. but there are no guarantees.
[09:26:09] dminuoso: Native extensions dont have that property.
[09:26:56] dminuoso: syndikate: If there's nothing in the app, then your question is just "does rails work with any version of ruby"
[09:27:05] dminuoso: Then the answer is pretty much yes.
[09:27:20] syndikate: dminuoso, yes my bad. I should have asked that. But was not sure of it.
[09:27:25] syndikate: I was thinking of the gems involved
[09:28:10] dminuoso: syndikate: the only major breaking change has been between 2.3 and 2.4 internally with the bigint > integer change
[09:38:28] nowhereman_: has joined #ruby
[09:39:15] psychicist__: has joined #ruby
[09:39:50] karapetyan: has joined #ruby
[09:50:21] Tempesta: has joined #ruby
[09:53:51] Azure: has joined #ruby
[09:55:25] karapetyan: has joined #ruby
[09:55:41] apeiros: dminuoso: I'd call the fdiv bug also a major breaking change. though I guess not that many were affected.
[09:56:56] dminuoso: apeiros: oh haha I thought you were talking about the FDIV bug on pentiums
[09:57:27] BlopMonster: has joined #ruby
[09:57:32] apeiros: but CPU bugs amaze me. mostly how little you hear about them. I guess there's a lot of people who do a great job working around them.
[09:58:04] dminuoso: apeiros: You kind of get confronted with that kind of stuff when you write kernel code.
[09:58:16] dminuoso: Especially "design quirks"
[09:58:23] dminuoso: Like the A20 gate
[09:58:33] dminuoso: (Though intel *finally* kicked that out of the window)
[09:58:53] apeiros: aaaaaahhaahaha, the a20 gate
[09:59:01] syndikate: Oh okay, thanks dminuoso
[09:59:05] dminuoso: apeiros: Do you know whats best about the a20 gate? Not the fact that it exists
[09:59:14] dminuoso: But the numerous and totally weird ways to toggle it.
[09:59:35] apeiros: the best I found the K6 cpu (I think that was its name) which worked differently and hence lots of stuff broke in hilarious ways.
[09:59:54] dminuoso: On some chips you have to interact with the keyboard controller (yes. seriously!) to enable/disable the A20 gate.
[09:59:59] apeiros: I barely remember. that's now what, 20y ago?
[10:00:14] apeiros: and I think a20 gate is still in x86, right? only 64x did away with it?
[10:00:23] dminuoso: only the most recent chips
[10:00:34] dminuoso: last or second last revision of the core series
[10:00:41] dminuoso: its still in there
[10:00:43] apeiros: what? 64x still had it?!?
[10:00:48] dminuoso: but at least its toggled off by default now
[10:01:04] dminuoso: well AMD64 is just an extra mode
[10:01:06] apeiros: I mean seriously, stuff old enough to care can now just be emulated.
[10:01:08] dminuoso: CPUs dont boot in AMD64 mode
[10:01:21] dminuoso: apeiros: well the thing is, I dont mind that they *exist*
[10:01:28] dminuoso: but the annoying thing is, they start with A20 turned off.
[10:01:33] apeiros: well, iirc switching was mandatory
[10:01:49] apeiros: and not just once, all the f*ing time. and you couldn't query the state either iirc.
[10:01:57] dminuoso: apeiros: not really
[10:01:57] apeiros: but… OT :D
[10:02:15] dminuoso: the whole existence is just because some stupid exotic software existed that relied on the wrap around of memory segmentation
[10:02:43] dminuoso: and because some retarded exotic programmers wrote some programs that relied on it, and intel didnt want to break backwards compatibility, they made sure that every CPU afterwards booted into a mode that had the same behavior..
[10:03:48] tvw: has joined #ruby
[10:04:00] dminuoso: nowadays you end up probing cpuid and *trying* various methods until you successfully enable the A20 gate
[10:04:27] dminuoso: usually you try the keyboard controller, try the bios, try some IO ports, and then hope any of it worked.
[10:04:50] dminuoso: (and each method has various actual ways, so you end up testing a fair 10 different techniques)
[10:05:08] dminuoso: okay more like 5
[10:13:38] simmaniac: has joined #ruby
[10:15:41] akem: has joined #ruby
[10:17:18] dionysus69: when :sym, "str", Db.find_by(some_object)
[10:17:51] dionysus69: I noticed very disappointing aspect of case statement
[10:18:19] dionysus69: if I provide sym or string as a when case, it still hits all the db finds in all when cases until it reaches when sttatement
[10:18:34] dionysus69: is this expected?
[10:19:31] apeiros: dionysus69: no
[10:19:39] apeiros: >> def foo; puts "FOO CALLED!"; end; case 1 when Integer, foo then "is int" else "what?" end
[10:19:40] ruby[bot]: apeiros: # => "is int" (https://eval.in/1016043)
[10:19:48] apeiros: it does not invoke foo, as you can see.
[10:19:54] apeiros: I'd assume your case statement is wrong.
[10:22:49] dionysus69: it checks all before it goes to next
[10:23:00] apeiros: well, yes, that of course
[10:23:13] jokester: i found `nil &+ ''` is a valid expression, but to my surprise it returns false (I expected it to work like `&.method`). does anybody knows what the operator is?
[10:23:14] apeiros: it wouldn't make sense otherwise
[10:23:24] jokester: oops sorry for interrupting
[10:23:24] dionysus69: I was dumb to assume that it would skip to next if i passed in str and str didnt match or symbol
[10:23:38] pabs: has joined #ruby
[10:23:51] dionysus69: any ideas on how I can achieve that? if it sees symbol and symbol doesn't match, it jumps to next when case
[10:23:52] apeiros: jokester: you probably have something which defines String#@+ (prefix + for string, like +1 and -1 for ints)
[10:24:20] apeiros: dionysus69: don't use case if you don't want its behavior?
[10:24:41] dionysus69: makes sense xD
[10:24:49] dionysus69: ok thanks :)
[10:25:13] apeiros: jokester: in other words, it's similar to writing "12 * -5" as "12 *- 5"
[10:25:14] jokester: apeiros: not likely? it behaves like that in a bare irb
[10:26:53] apeiros: seems ruby defines it
[10:27:02] apeiros: and it's +@, not @+, sorry.
[10:27:15] jokester: ah, that explains it
[10:27:35] jokester: `nil & (+'')` evals to false
[10:27:53] jokester: thanks apeiros /o\
[10:28:16] apeiros: I'm actually curious what /o\ is supposed to mean in this context :D
[10:28:57] jokester: just covering my eyes, nothing much ;D
[10:29:12] agimenez: has joined #ruby
[10:29:23] apeiros: 🙈 <- this?
[10:32:17] Emmanuel_Chanel: has joined #ruby
[10:32:52] Emmanuel_Chanel: has joined #ruby
[10:39:16] darix: apeiros: https://cdn.iwastesomuchtime.com/October-18-2011-20-12-49-DoubleFacePalm.jpg
[10:40:04] apeiros: ACTION breaking non-utf8-save irc logs since 2000
[10:40:36] suukim: has joined #ruby
[10:40:40] darix: apeiros: good thing IRC has ways to specify the encoding of each message so the client can convert it to their local encoding ;)
[10:40:54] DTZUZO: has joined #ruby
[10:41:01] apeiros: yeah, but it's hardly surprising, given that even textfiles have that.
[10:41:41] apeiros: (you *actually* could use irc3.2 tagging mechanism for encoding, but: lel)
[10:43:49] darix: apeiros: I was using sarcasm there ;)
[10:44:08] apeiros: I thought my follow up was obviously sarcastic too? o0
[10:44:53] darix: the first line sounded too serious
[10:45:17] apeiros: 😅 ok then
[10:46:09] apparition: has joined #ruby
[10:46:10] apeiros: I thought "which friggn encoding does this effin text file use?!?" was a common enough problem that "textfiles have a way to specify the encoding" was clearly enough a joke.
[10:46:12] apeiros: my apologies
[10:46:28] apeiros: I guess I'm the only one who's frequently troubled by that kind of shit 😂
[10:49:35] pabs: has joined #ruby
[10:51:10] cdunklau: apeiros: just use latin-1, it always works!
[10:53:15] torarne: has left #ruby: ("Kicked by @appservice-irc:matrix.org : issued !quit command")
[10:55:05] emilford: has joined #ruby
[10:55:27] yxhuvud: has joined #ruby
[10:56:21] andikr: has joined #ruby
[10:57:02] apeiros: cdunklau: pro-tip, use windows-1252 instead of latin1, it's a strict superset.
[11:04:28] cdunklau: i always mix those up
[11:04:47] ferr: has joined #ruby
[11:05:31] cdunklau: because python's latin-1 decoder just maps the bytes missing from latin-1 directly to their codepoint value
[11:07:10] dr3wo: has joined #ruby
[11:13:53] cschneid: has joined #ruby
[11:16:29] mtkd: has joined #ruby
[11:18:18] darix: apparition: use utf-8 or die
[11:18:28] darix: apeiros left
[11:20:06] lupine: imperialist
[11:22:03] cyberg: has joined #ruby
[11:24:05] AJA4350: has joined #ruby
[11:25:03] plexigras: has joined #ruby
[11:27:26] Zaab1t: has joined #ruby
[11:29:22] shinnya: has joined #ruby
[11:29:34] ldnunes: has joined #ruby
[11:29:37] apeiros: has joined #ruby
[11:33:34] amar: has joined #ruby
[11:36:10] anisha: has joined #ruby
[11:36:16] Tolnaiz: has joined #ruby
[11:38:05] dendazen: has joined #ruby
[11:39:14] jrafanie: has joined #ruby
[11:40:57] jgpawletko: has joined #ruby
[11:55:13] eelster_: has joined #ruby
[12:00:24] vondruch_: has joined #ruby
[12:03:17] synthroid: has joined #ruby
[12:06:50] jamesaxl: has joined #ruby
[12:09:49] roshanavand: has joined #ruby
[12:17:57] karapetyan: has joined #ruby
[12:20:15] jrafanie: has joined #ruby
[12:21:04] vutral|kali: has joined #ruby
[12:21:23] vutral|kali: where is the dbd documentation?
[12:22:58] dminuoso: vutral|kali: this? https://www.rubydoc.info/github/erikh/ruby-dbi/DBI
[12:24:35] ellcs: has joined #ruby
[12:24:37] Sylario: has joined #ruby
[12:28:11] darix: vutral|kali: use sequel or so
[12:29:34] siery: has joined #ruby
[12:31:12] conta: has joined #ruby
[12:34:03] Silex: has joined #ruby
[12:34:22] chamar: has joined #ruby
[12:34:40] bmurt: has joined #ruby
[12:43:38] conta: has joined #ruby
[13:02:11] synthroid: has joined #ruby
[13:02:37] regedit: has joined #ruby
[13:04:40] regedit: havenwood: still there? do i need to do anything to expressly use such a connection pool? or it happens behind the scenes
[13:06:16] regedit: ah nvm i think my answer should be here https://github.com/mperham/sidekiq/wiki/Advanced-Options#connection-pooling
[13:08:24] regedit: havenwood: is your recommendation to use connection_pool with HTTP.rb or Typhoeus?
[13:10:51] Silex: Doesn't both HTTP.rb and Typhoeus have threading issues?
[13:10:54] nielsk: has joined #ruby
[13:11:23] BlopMonster: has joined #ruby
[13:12:19] Silex: Ah no, HTTP.rb seems thread-safe
[13:14:11] Silex: https://github.com/httprb/http/wiki/Thread-Safety
[13:16:22] regedit: Silex: any idea how do use HTTP.rb in conjunction with (sidekiq with) connection_pool ?
[13:17:04] bmurt: has joined #ruby
[13:19:09] vondruch: has joined #ruby
[13:19:11] regedit: oh lol your above URL discusses exactly that :D thanks
[13:21:46] conta1: has joined #ruby
[13:22:24] regedit: the last mystery to solve would be how to do this https://github.com/httprb/http/wiki/Thread-Safety in a sidekiq worker so that the http connection is persisted across hundreds of distinct sidekiq worker executions...
[13:22:54] regedit: and then somehow close the connection pool at the right time after the batch of said sidekiq jobs have completed
[13:24:09] cdunklau: does ruby a good async networking framework?
[13:24:36] cdunklau: like, reactor pattern style, hopefully with good implementations of common application protocols?
[13:24:53] dminuoso: cdunklau: theres EM
[13:25:12] dminuoso: cdunklau: https://github.com/eventmachine/eventmachine
[13:25:49] dminuoso: cdunklau: There's also celluloid that you might be interested in.
[13:27:59] cdunklau: oh neat, EM looks remarkably similar to twisted
[13:30:21] zhangkaizhao_: has joined #ruby
[13:34:22] ruby[bot]: -b *!*@c-71-232-61-105.hsd1.ma.comcast.net$#ruby-banned
[13:35:52] ramfjord: has joined #ruby
[13:36:32] griffindy: has joined #ruby
[13:37:22] ruby[bot]: -b *!*@a83-162-252-233.adsl.xs4all.nl$#ruby-banned
[13:39:11] dr3wo: has joined #ruby
[13:46:04] k0mpa: has joined #ruby
[13:47:00] tvw: has joined #ruby
[13:49:08] Rapture: has joined #ruby
[13:56:24] shinnya: has joined #ruby
[14:00:30] Asher: has joined #ruby
[14:02:28] karapetyan: has joined #ruby
[14:02:45] pastorinni: has joined #ruby
[14:05:38] mtkd: has joined #ruby
[14:11:10] jrafanie: has joined #ruby
[14:11:55] mlkkk: has joined #ruby
[14:15:28] conta1: has joined #ruby
[14:24:21] chat_: has joined #ruby
[14:28:38] drale2k_: has joined #ruby
[14:29:00] BlopMonster: has joined #ruby
[14:31:59] rsh: has joined #ruby
[14:36:41] BloopMonster: has joined #ruby
[14:37:10] chat: has joined #ruby
[14:42:03] karapetyan: has joined #ruby
[14:42:45] Asher: has joined #ruby
[14:43:25] bmurt: has joined #ruby
[14:44:55] sysvalve: has joined #ruby
[14:53:26] vondruch: has joined #ruby
[14:54:18] vondruch_: has joined #ruby
[14:55:44] bmurt: has joined #ruby
[14:59:12] vondruch: has joined #ruby
[15:06:43] CrazyEddy: has joined #ruby
[15:16:41] cagomez: has joined #ruby
[15:18:21] amar_: has joined #ruby
[15:18:37] za1b1tsu: has joined #ruby
[15:20:49] karapetyan: has joined #ruby
[15:21:33] cagomez: has joined #ruby
[15:23:05] rippa: has joined #ruby
[15:25:06] cschneid: has joined #ruby
[15:27:09] karapetyan: has joined #ruby
[15:32:18] nowhere_man: has joined #ruby
[15:40:30] modin: has joined #ruby
[15:43:21] jottr: has joined #ruby
[15:47:58] guacamole: has joined #ruby
[15:47:58] guacamole: has joined #ruby
[15:49:41] nowhere_man: has joined #ruby
[15:52:22] chamar: has joined #ruby
[16:01:23] jcarl43: has joined #ruby
[16:02:13] mzo: has joined #ruby
[16:04:56] plexigras: has joined #ruby
[16:05:15] jenrzzz: has joined #ruby
[16:05:29] Mike11: has joined #ruby
[16:06:10] akaiiro: has joined #ruby
[16:13:19] mostlybadfly: has joined #ruby
[16:13:21] howdoi: has joined #ruby
[16:14:00] c0ncealed1: has joined #ruby
[16:15:50] pastorinni: has joined #ruby
[16:17:04] Mike111: has joined #ruby
[16:19:52] k0mpa: has joined #ruby
[16:24:37] darkhanb: has joined #ruby
[16:24:44] Mike11: has joined #ruby
[16:25:00] chat_: has joined #ruby
[16:25:04] Mike11: has joined #ruby
[16:26:25] emilford: has joined #ruby
[16:28:06] apeiros: has joined #ruby
[16:30:35] guille-moe: has joined #ruby
[16:31:48] emilford: has joined #ruby
[16:34:35] wkoszek_: has joined #ruby
[16:37:37] BlopMonster: has joined #ruby
[16:44:26] bmurt: has joined #ruby
[16:44:27] karapetyan: has joined #ruby
[16:44:30] elsurudo: has joined #ruby
[16:46:35] elsurudo: I have some code that needs to run in a block of a method in a third-party lib, but then code I need to run in a block is async and it can “complete” outside of the scope of the block (in a compeltion handler). Is there any sane way to make these two approaches co-operate? Something like make the block halt until competion?
[16:47:59] mtkd: has joined #ruby
[16:48:23] emilford: has joined #ruby
[16:49:30] pabs: has joined #ruby
[16:52:50] apeiros: elsurudo: sure. depends on how the async is implemented. if it runs in its own thread, you can stop it. see e.g. ConditionVariable.
[16:53:04] WAFFLEMAKER3000: has joined #ruby
[16:53:19] tvw: has joined #ruby
[16:53:49] tAn: has joined #ruby
[16:54:30] Cavallari: has joined #ruby
[16:55:56] roshanavand: has joined #ruby
[16:58:03] elsurudo: apeiros: Right, that makes sense. The issue is I’m dealing with Faraday callbacks, and since Faraday can use one of many adapters (some of which are single-threaded, and some of which aren’t), there may not be a one-size-fits-all solution.
[16:58:25] jrafanie_: has joined #ruby
[17:03:02] elsurudo: apeiros: if I want to limit myself to only single-threaded adapters, I suppose there is no solution?
[17:03:09] emilford: has joined #ruby
[17:03:42] apeiros: in a single threaded solution there isn't really "something else finishes while I work here"
[17:04:10] apeiros: i.e. in a single threaded solution, you just write normal blocking code.
[17:05:44] wkoszek_: has joined #ruby
[17:08:58] sanscoeur: has joined #ruby
[17:11:28] emilford: has joined #ruby
[17:11:56] cadillac_: has joined #ruby
[17:16:11] TomyLobo: has joined #ruby
[17:23:12] dionysus69: has joined #ruby
[17:29:41] jcalla: has joined #ruby
[17:31:38] hahuang65: has joined #ruby
[17:32:49] mtkd: has joined #ruby
[17:35:07] amar: has joined #ruby
[17:35:10] jenrzzz: has joined #ruby
[17:35:10] jenrzzz: has joined #ruby
[17:36:36] sphenxes: has joined #ruby
[17:38:03] cadillac_: has joined #ruby
[17:38:17] amar: has joined #ruby
[17:38:36] kliq: has joined #ruby
[17:40:02] ldepandis: has joined #ruby
[17:42:16] karapetyan: has joined #ruby
[17:43:14] SeepingN: has joined #ruby
[17:43:26] emilford: has joined #ruby
[17:47:51] banisterfiend: has joined #ruby
[17:51:22] jamesaxl: has joined #ruby
[17:54:35] dank: has joined #ruby
[17:55:17] eckhardt_: has joined #ruby
[17:55:37] guille-moe: has joined #ruby
[17:57:04] pabs: has joined #ruby
[17:57:43] dank: fun fact: in build mac os 10.14 beta (18A293u), ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyarchhdrdir"];' outputs a value that is off by one. This caused my build to fail to find ruby/config.h.
[17:58:40] ellcs: has joined #ruby
[17:59:04] havenwood: dank: What do you get for?: uname -r
[18:00:55] emilford: has joined #ruby
[18:03:09] theRoUS: #warn is recommended over $stderr.puts -- but what's the non-newline equivalent, like $stderr.print ?
[18:03:28] amar_: has joined #ruby
[18:05:28] jenrzzz_: has joined #ruby
[18:06:26] havenwood: dank: (( $(uname -r | cut -d'.' -f1) == $(ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyarchhdrdir"]' | cut -d" " -f4 | tail -c3) )) && echo "Identical" || echo "Different"
[18:07:21] dank: uname -r says 18.0.0
[18:08:18] dank: That command outputs Identical
[18:08:28] dank: Seems like a packaging error
[18:08:32] havenwood: dank: So it seems they agree, it's 18?
[18:09:15] elsurudo: has joined #ruby
[18:09:33] dank: but /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18 does not exist.
[18:09:56] elsurudo: has joined #ruby
[18:10:04] dank: Instead, /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17 exists. Whoops...
[18:10:12] dank: Reported to apple.
[18:10:36] dank: Might be taken more seriously if a ruby developer reports it, though?
[18:10:48] elsurudo: has joined #ruby
[18:11:15] dank: as in, the more people report it, the sooner it'll get fixed. Which reminds me, I should check to see if /etc/paths.d is fixed yet.
[18:11:34] elsurudo: has joined #ruby
[18:12:21] elsurudo: has joined #ruby
[18:13:06] elsurudo: has joined #ruby
[18:13:51] elsurudo: has joined #ruby
[18:14:37] elsurudo: has joined #ruby
[18:17:26] havenwood: theRoUS: It's a good point. There isn't such a method.
[18:17:59] theRoUS: havenwood: that's what i feared..
[18:18:10] shadeslayer: has joined #ruby
[18:19:09] havenwood: theRoUS: A keyword argument might be nice to add for: trailing_newline: false
[18:19:10] havenwood: theRoUS: or yeah, another methods
[18:19:36] tAn: has joined #ruby
[18:21:44] ramfjord: has joined #ruby
[18:26:20] elsurudo: has joined #ruby
[18:26:34] m27frogy: has joined #ruby
[18:27:12] apeiros: say it like a toad: kwaaaarg
[18:27:43] mlkkk: has joined #ruby
[18:27:51] apeiros: (seriously, though, I always imagining it sounding like a toad making its noise when I read it)
[18:27:54] havenwood: ACTION croaks kwaaarg
[18:30:27] mlkkk_: has joined #ruby
[18:30:43] theRoUS: wait, what?
[18:33:02] z64: kwaaaaaaarg! :D
[18:36:36] mtkd: has joined #ruby
[18:37:57] Emmanuel_Chanel: has joined #ruby
[18:38:24] Emmanuel_Chanel: has joined #ruby
[18:39:52] akaiiro: has joined #ruby
[18:41:11] dionysus69: has joined #ruby
[18:41:18] llua`: has joined #ruby
[18:45:16] emilford: has joined #ruby
[18:48:40] Nuve: has joined #ruby
[18:51:41] Zaab1t: has joined #ruby
[18:55:22] amar: has joined #ruby
[18:55:29] karapetyan: has joined #ruby
[18:56:06] shadeslayer: has joined #ruby
[18:57:01] jenrzzz: has joined #ruby
[18:59:27] clemens3: has joined #ruby
[19:04:03] jcalla: has joined #ruby
[19:08:45] ellcs: has left #ruby: ()
[19:12:43] redlegion: has joined #ruby
[19:14:21] wkoszek_: has joined #ruby
[19:20:49] cagomez: has joined #ruby
[19:37:34] synthroid: has joined #ruby
[19:38:02] tdy: has joined #ruby
[19:38:34] BlopMonster: has joined #ruby
[19:45:44] karapetyan: has joined #ruby
[19:52:16] cagomez: has joined #ruby
[19:52:29] pabs: has joined #ruby
[19:54:15] dionysus69: has joined #ruby
[19:56:15] quobo: has joined #ruby
[19:57:06] amar_: has joined #ruby
[19:58:11] tAn: has joined #ruby
[20:01:59] \void: has joined #ruby
[20:02:46] wkoszek__: has joined #ruby
[20:03:40] jenrzzz: has joined #ruby
[20:03:40] jenrzzz: has joined #ruby
[20:04:22] ramfjord: has joined #ruby
[20:05:17] t0xik: has joined #ruby
[20:05:17] cadillac_: has joined #ruby
[20:05:37] weaksauce: has joined #ruby
[20:07:23] tAn: has joined #ruby
[20:07:37] cagomez: has joined #ruby
[20:08:49] roshanavand: has joined #ruby
[20:12:03] Keltia: has joined #ruby
[20:13:13] armando1: has joined #ruby
[20:17:02] _aeris_: has joined #ruby
[20:19:19] sauvin: has joined #ruby
[20:27:15] Nuve: has joined #ruby
[20:28:52] Nuve: has joined #ruby
[20:35:35] p0s1x: has joined #ruby
[20:41:49] plexigras: has joined #ruby
[20:43:23] Dimik: has joined #ruby
[20:44:49] VladGh: has joined #ruby
[20:54:21] ramfjord: has joined #ruby
[20:57:26] ur5us: has joined #ruby
[21:02:17] Nuve: has joined #ruby
[21:07:43] za1b1tsu: has joined #ruby
[21:08:44] llua`: has joined #ruby
[21:09:40] Azure: has joined #ruby
[21:11:46] pabs: has joined #ruby
[21:12:49] cagomez: has joined #ruby
[21:17:35] cyberg: has joined #ruby
[21:20:34] pastorinni: has joined #ruby
[21:31:55] TvL: has joined #ruby
[21:35:46] pabs: has joined #ruby
[21:37:49] cagomez: has joined #ruby
[21:51:43] Yzguy: has joined #ruby
[21:53:26] gr33n7007h: has joined #ruby
[21:58:37] mlkkk: has joined #ruby
[21:58:38] Junaos: has joined #ruby
[22:03:17] Yzguy: has joined #ruby
[22:05:23] Jiaoyin: Anyone here plans to switch over to GitLab because Microsoft purchased GitHub?
[22:11:42] llua: gitlab is hosted on azure tho
[22:14:47] SeepingN: Microsoft. Winning via Brute Force
[22:17:03] eckhardt_: has joined #ruby
[22:19:19] ur5us: has joined #ruby
[22:21:05] conceivably: has joined #ruby
[22:22:25] jenrzzz: has joined #ruby
[22:26:41] Yzguy: has joined #ruby
[22:27:33] ramfjord: has joined #ruby
[22:28:24] Owner: has joined #ruby
[22:29:40] mistym: has joined #ruby
[22:29:41] mistym: has joined #ruby
[22:33:12] orbyt_: has joined #ruby
[22:40:45] nickjj: Jiaoyin, that would be a rash decision without first seeing what happens
[22:43:46] baweaver: Programmers are a bit too reactionary sometimes.
[22:44:28] RougeR: has joined #ruby
[22:50:01] pabs: has joined #ruby
[22:55:23] regedit: havenwood: hey
[22:55:56] jenrzzz: has joined #ruby
[22:55:56] jenrzzz: has joined #ruby
[22:57:55] shinnya: has joined #ruby
[22:58:04] baweaver: He's running around at a conference regedit. probably won't be around for a bit
[22:58:14] regedit: oh cool, what conference?
[22:58:21] baweaver: AltConf iirc
[22:58:53] baweaver: It's not unusual to see me and him running around Ruby conferences
[22:59:04] regedit: is anyone successfully using Sidekiq + connection_pool + HTTP.rb to make a bunch of keep-alive requests across many distinct executions of a Sidekiq Worker?
[22:59:08] nickjj: baweaver, it's true. one day you could be 5k+ lines deep in a side project, the world is amazing, then you see a video about some other tech and you're like "my life isn't complete until I learn this" so you insta abort / rewrite
[22:59:13] nickjj: i used to do that stuff a lot like 5 years ago haha
[22:59:46] baweaver: Just wait until it cycles
[22:59:56] baweaver: What's old becomes new
[23:00:08] baweaver: Like GraphQL is basically SOAP with JSON
[23:00:47] fredlinhares: has joined #ruby
[23:01:04] nickjj: i saw an advert for a new editor the other day and one perk was you could load a browser in a code editing tab
[23:01:42] nickjj: but it made me think of an old memory from back in the VB6 days which made me think "oh cool, i can finally see the output of the programs i'm writing in my browser... just like i was doing in 1997"
[23:01:56] nickjj: *in my editor
[23:02:02] ramfjord_: has joined #ruby
[23:02:57] baweaver: or Dreamweaver
[23:03:01] jenrzzz: has joined #ruby
[23:03:01] jenrzzz: has joined #ruby
[23:07:51] ramfjord: has joined #ruby
[23:14:55] apeiros: has joined #ruby
[23:15:42] jenrzzz: has joined #ruby
[23:15:42] jenrzzz: has joined #ruby
[23:17:14] burgestrand: has joined #ruby
[23:17:31] icarus: has joined #ruby
[23:19:20] SirFunk: has joined #ruby
[23:23:34] kwerle: has joined #ruby
[23:24:13] kwerle: has joined #ruby
[23:24:49] griffindy: has joined #ruby
[23:24:49] srruby: has joined #ruby
[23:25:58] kwerle: I'm looking for something I feel like I should know. I want to do `enumerable.detect{ |key| expensive_process(key) }` -- but I want to return the results of expensive_process (when it's truthy), NOT the key. Does that exist?
[23:27:33] amar: has joined #ruby
[23:27:34] sj0rz: has joined #ruby
[23:28:06] sj0rz: has left #ruby: ()
[23:38:19] Radar: kwerle: enumerable.lazy.map { |key| expensive_process(key) }.detect(&:yield_self) ? At a big guess. I haven't tried it in the terminal at all yet.
[23:39:06] armyriad: has joined #ruby
[23:39:20] Radar: Ok, tried it and I'm off the mark.
[23:39:56] BlopMonster: has joined #ruby
[23:45:37] jenrzzz: has joined #ruby
[23:45:38] jenrzzz: has joined #ruby
[23:48:43] baweaver: >> def exp_proc(v) v == 42 end; [1,2,50,42,20,3].reduce(nil) { |_, i| v = exp_proc(i); break v if v } # kwerle
[23:48:44] ruby[bot]: baweaver: # => true (https://eval.in/1016453)
[23:48:57] baweaver: >> def exp_proc(v) v == 42 end; [1,2,50,20,3].reduce(nil) { |_, i| v = exp_proc(i); break v if v } # kwerle
[23:48:58] ruby[bot]: baweaver: # => nil (https://eval.in/1016454)
[23:52:06] baweaver: >> module Enumerable; def find_map(&fn); v = find(&fn) and fn[v] end; end; [[1,2,3,4].find_map { |v| v > 3 && v * 20 }, [1,2,3].find_map { |v| v > 3 && v * 20 }]
[23:52:07] ruby[bot]: baweaver: # => [80, nil] (https://eval.in/1016455)
[23:52:32] baweaver: Radar: cookie plz
[23:53:43] ResidentBiscuit: has joined #ruby
[23:58:07] baweaver: >> def guard(cond, &fn) proc { |target| r = cond === target; [r, r && fn[target]] } end; g = guard(Integer) { |v| v * 20 }; {ten: g.call(10), nil: g.call(nil)}
[23:58:08] ruby[bot]: baweaver: # => {:ten=>[true, 200], :nil=>[false, false]} (https://eval.in/1016456)
[23:58:16] venmx: has joined #ruby
[23:58:28] baweaver: If you use a "guard" type pattern you can even return falsy values that are "matches"