« Back to channel list

#ruby - 08 July 2019

« Back 1 day Forward 1 day »
[00:05:56] brool: has joined #ruby
[00:11:46] orbyt_: has joined #ruby
[00:11:52] fphilipe_: has joined #ruby
[00:39:11] emptyfl4sk: has joined #ruby
[00:41:43] exmortus: has joined #ruby
[00:47:44] txdv: has joined #ruby
[01:27:50] emptyfl4sk: has joined #ruby
[01:38:22] tdy: has joined #ruby
[01:58:22] chalkmonster: has joined #ruby
[02:01:02] involans: has joined #ruby
[02:17:08] emptyfl4sk: has joined #ruby
[02:21:45] esrse: has joined #ruby
[02:31:11] tdy: has joined #ruby
[02:35:05] envex: has joined #ruby
[02:43:37] fphilipe_: has joined #ruby
[02:46:15] sarink: has joined #ruby
[02:55:48] emptyfl4sk: has joined #ruby
[03:06:19] Technodrome: has joined #ruby
[03:11:24] braincrash: has joined #ruby
[03:25:55] Junaos: has joined #ruby
[03:49:39] tdy: has joined #ruby
[03:53:56] gix-: has joined #ruby
[03:55:09] nowhereman: has joined #ruby
[04:08:51] Nicmavr: has joined #ruby
[04:09:19] brett-soric: has joined #ruby
[04:14:06] englishm: has joined #ruby
[04:14:20] akemot: has joined #ruby
[04:21:43] Swyper: has joined #ruby
[04:46:25] SeepingN: has joined #ruby
[04:50:40] englishm: has joined #ruby
[04:58:57] matheusmoreira: has joined #ruby
[04:59:00] brett-soric: has left #ruby: ()
[05:03:20] DTZUZO: has joined #ruby
[05:03:38] za1b1tsu: has joined #ruby
[05:05:47] emptyfl4sk: has joined #ruby
[05:10:10] sagax: has joined #ruby
[05:13:48] fphilipe_: has joined #ruby
[05:23:43] conta: has joined #ruby
[05:25:16] za1b1tsu: has joined #ruby
[05:25:47] lord4163: has joined #ruby
[05:27:56] polishdub: has joined #ruby
[05:30:33] conta: has joined #ruby
[05:35:19] matheusmoreira: has joined #ruby
[05:44:17] conta: has joined #ruby
[05:48:16] emptyfl4sk: has joined #ruby
[05:50:12] kyrylo: has joined #ruby
[05:57:10] _whitelogger: has joined #ruby
[05:57:31] schne1der: has joined #ruby
[06:12:06] sarink: has joined #ruby
[06:25:31] sandstrom: has joined #ruby
[06:33:57] za1b1tsu: has joined #ruby
[06:38:41] aupadhye: has joined #ruby
[06:40:47] emptyfl4sk: has joined #ruby
[06:43:21] andikr: has joined #ruby
[06:43:36] clemens3: has joined #ruby
[06:47:42] fphilipe_: has joined #ruby
[06:48:52] also_uplime: has joined #ruby
[06:50:58] also_uplime: in eventmachine, is there a way to pass an argument to a handler? something like EventMachine.connect("host", 1234, Handler, { some: "options" }) and then module Handler def post_init(opts) @opts = opts end
[06:59:45] fphilipe_: has joined #ruby
[06:59:54] also_uplime: ah, i see. i need to give it a class
[06:59:56] also_uplime: has left #ruby: ("/me scurries away")
[07:02:12] howdoi: has joined #ruby
[07:05:43] conta: has joined #ruby
[07:08:02] schne1der: has joined #ruby
[07:08:20] rafadc: has joined #ruby
[07:13:32] miskatonic: has joined #ruby
[07:19:01] DTZUZO: has joined #ruby
[07:22:14] mayurvpatil: has joined #ruby
[07:23:05] emptyfl4sk: has joined #ruby
[07:25:32] BH23: has joined #ruby
[07:28:22] fphilipe_: has joined #ruby
[07:28:29] Cork: is it possible to get OpenSSL::PKey::RSA.new to NOT ask for password if given an encrypted private key?
[07:28:50] lxsameer: has joined #ruby
[07:31:17] absolutejam1: has joined #ruby
[07:39:07] deepredsky: has joined #ruby
[07:41:01] DEac-: has joined #ruby
[07:59:18] reber: has joined #ruby
[07:59:59] ovnimancer: has joined #ruby
[08:01:16] sandstrom: has joined #ruby
[08:01:33] andikr: has joined #ruby
[08:04:29] queip: has joined #ruby
[08:06:42] emptyfl4sk: has joined #ruby
[08:08:05] lepepe: has joined #ruby
[08:13:46] Bounga: has joined #ruby
[08:14:07] BH23: has joined #ruby
[08:24:35] conta: has joined #ruby
[08:28:28] m27frogy_: has joined #ruby
[08:29:54] ovnimancer: has joined #ruby
[08:30:58] ellcs: has joined #ruby
[08:42:10] jefffrails35: has joined #ruby
[08:46:03] DEac-: has joined #ruby
[08:47:58] emptyfl4sk: has joined #ruby
[09:04:54] johnny56: has joined #ruby
[09:05:48] andikr: has joined #ruby
[09:06:35] UnionJack: has joined #ruby
[09:07:06] UnionJack: has left #ruby: ()
[09:29:49] emptyfl4sk: has joined #ruby
[09:38:30] absolutejam1: has joined #ruby
[09:47:32] lepepe: has joined #ruby
[09:53:00] cassolas: has joined #ruby
[09:54:49] unreal: has joined #ruby
[09:55:09] leitz: has joined #ruby
[09:58:26] kyrylo: has joined #ruby
[10:05:26] emptyfl4sk: has joined #ruby
[10:24:13] conta: has joined #ruby
[10:29:12] RUDIS: has joined #ruby
[10:33:05] RUDIS: Can I create a Ruby C extension that uses the oniguruma lib without colliding with Ruby's modified onigmo version?
[10:46:58] RUDIS: has joined #ruby
[10:47:31] RUDIS: has joined #ruby
[10:55:12] emptyfl4sk: has joined #ruby
[10:55:34] armyriad: has joined #ruby
[10:55:39] davor: has joined #ruby
[11:05:09] jrafanie: has joined #ruby
[11:07:20] sarink: has joined #ruby
[11:10:23] sarink: has joined #ruby
[11:12:11] AJA4350: has joined #ruby
[11:24:09] stooj: has joined #ruby
[11:28:35] lepepe: has joined #ruby
[11:31:36] suukim: has joined #ruby
[11:44:03] akem-lnvo: has joined #ruby
[11:44:03] guest22: has joined #ruby
[11:46:24] emptyfl4sk: has joined #ruby
[11:46:27] guest22: has left #ruby: ()
[11:46:35] lepepe: has joined #ruby
[11:47:35] guest22: has joined #ruby
[11:50:48] sarink: has joined #ruby
[11:51:32] DaRock: has joined #ruby
[11:52:30] fphilipe_: has joined #ruby
[11:57:15] lepepe: has joined #ruby
[12:01:50] deathwishdave: has joined #ruby
[12:02:33] yo-wan: has joined #ruby
[12:05:27] conta: has joined #ruby
[12:05:43] johnny56: has joined #ruby
[12:09:57] lepepe: has joined #ruby
[12:21:16] emptyfl4sk: has joined #ruby
[12:30:41] sarink: has joined #ruby
[12:36:30] tuor: has joined #ruby
[12:41:43] za1b1tsu: has joined #ruby
[12:41:46] conta: has joined #ruby
[12:41:58] cisco: has joined #ruby
[12:42:39] lepepe: has joined #ruby
[12:47:09] lepepe: has joined #ruby
[12:49:46] lepepe: has joined #ruby
[12:50:42] sarink: has joined #ruby
[13:04:16] lepepe_: has joined #ruby
[13:06:32] sarink: has joined #ruby
[13:10:08] al2o3-cr: has joined #ruby
[13:16:22] involans: has joined #ruby
[13:20:38] Esa_: has joined #ruby
[13:27:07] jcalla: has joined #ruby
[13:27:30] sarink: has joined #ruby
[13:27:36] davor: has joined #ruby
[13:31:49] vondruch_: has joined #ruby
[13:36:05] fphilipe_: has joined #ruby
[13:38:35] absolutejam: has joined #ruby
[13:39:26] Swyper: has joined #ruby
[13:41:17] queip: has joined #ruby
[13:41:58] Megamos: has joined #ruby
[13:49:17] sarink: has joined #ruby
[13:53:00] Swyper: has joined #ruby
[13:53:26] Ropeney: has joined #ruby
[13:56:17] fphilipe_: has joined #ruby
[14:05:39] jrafanie: has joined #ruby
[14:08:15] sarink: has joined #ruby
[14:10:26] Sylario: has joined #ruby
[14:15:40] Bish: has joined #ruby
[14:22:16] emptyfl4sk: has joined #ruby
[14:22:33] fphilipe_: has joined #ruby
[14:27:12] Swyper: has joined #ruby
[14:27:17] fphilipe: has joined #ruby
[14:28:48] sarink: has joined #ruby
[14:29:00] _falsebay_: has joined #ruby
[14:30:57] vondruch: has joined #ruby
[14:33:53] havenwood: zenspider: I'm curious about your thoughts on `it`? https://bugs.ruby-lang.org/issues/15897
[14:41:22] sarink: has joined #ruby
[14:45:10] yxhuvud: has joined #ruby
[14:45:32] sarink: has joined #ruby
[14:46:39] kyrylo_: has joined #ruby
[14:47:35] sarink: has joined #ruby
[14:48:37] Nicmavr: has joined #ruby
[14:50:29] sandstrom: has joined #ruby
[14:52:03] conta: has joined #ruby
[14:59:13] LtHummus: has joined #ruby
[15:00:13] Bish: ACTION said we need this 3 years or something ago
[15:01:29] SeepingN: has joined #ruby
[15:10:22] vdl: has joined #ruby
[15:21:20] ascarter: has joined #ruby
[15:21:22] sarink: has joined #ruby
[15:21:31] sarink: has joined #ruby
[15:25:27] Dbugger: has joined #ruby
[15:27:38] ascarter: has joined #ruby
[15:29:41] jrafanie: has joined #ruby
[15:35:23] Dr_MDMA_MD: has joined #ruby
[15:35:50] orbyt_: has joined #ruby
[15:35:50] cjohnson: has joined #ruby
[15:38:42] reber: has joined #ruby
[15:45:17] sarink: has joined #ruby
[15:47:36] _dreamer: has joined #ruby
[15:48:05] _dreamer: has left #ruby: ()
[15:50:41] rippa: has joined #ruby
[16:00:29] tdy: has joined #ruby
[16:02:48] emptyfl4sk: has joined #ruby
[16:03:32] ua_: has joined #ruby
[16:05:34] Bounga`: has joined #ruby
[16:06:14] chromis: has left #ruby: ()
[16:10:35] Swyper: has joined #ruby
[16:13:42] leitz: havenwood, I've put some date parameters to my project status. I've been reading "Deep Work" and "Software Craftsmanship" (McBreen). While I don't fully agree with the latter, having a small working project seems a good step towards journeyman. Goal is to have it up by 1 Oct 2019.
[16:16:24] havenwood: &>> require 'date'; "#{Integer Date.new(2019, 10, 1) - Date.today} days to go!" # leitz
[16:16:31] rubydoc: stderr: playpen: timeout triggered! (https://carc.in/#/r/771o)
[16:16:44] havenwood: #=> "85 days to go!"
[16:19:00] sphenxes: has joined #ruby
[16:28:38] emptyfl4sk: has joined #ruby
[16:38:24] schne1der: has joined #ruby
[16:38:35] tuor: has joined #ruby
[16:39:47] houhoulis: has joined #ruby
[16:42:29] gix: has joined #ruby
[16:46:15] conta: has joined #ruby
[16:48:44] lord4163: has joined #ruby
[16:52:27] ci-pod-mod: has joined #ruby
[16:54:57] DTZUZO: has joined #ruby
[16:55:57] kyrylo_: has joined #ruby
[17:02:24] deepredsky: has joined #ruby
[17:10:51] deepreds1: has joined #ruby
[17:11:34] johnny56: has joined #ruby
[17:19:29] kurko_: has joined #ruby
[17:22:55] dellavg_: has joined #ruby
[17:27:26] Net: how do you feel about classes that include many modules resulting in a large public api?
[17:27:43] brool: has joined #ruby
[17:28:25] Net: my problem with them is that it makes it hard to locate the source of a given method as you can't simply open the class and search for the method
[17:29:04] Net: and I'm wondering if this is valid criticism
[17:36:03] tuor: has joined #ruby
[17:42:11] crankharder: has joined #ruby
[17:46:13] DTZUZO: has joined #ruby
[17:46:49] NL3limin4t0r: Net: You can use #owner to see where the method is defined.
[17:47:05] NL3limin4t0r: &>> {}.method(:reject).owner
[17:47:06] rubydoc: # => Hash (https://carc.in/#/r/771r)
[17:47:42] NL3limin4t0r: &>> {}.method(:each_slice).owner
[17:47:43] rubydoc: # => Enumerable (https://carc.in/#/r/771s)
[17:48:35] NL3limin4t0r: This also works for unbound methods.
[17:49:01] NL3limin4t0r: &>> Hash.instance_method(:each_slice).owner
[17:49:02] rubydoc: # => Enumerable (https://carc.in/#/r/771t)
[17:54:46] Inline: has joined #ruby
[17:56:56] fphilipe: has joined #ruby
[18:02:15] Renich: has joined #ruby
[18:09:12] rprimus: has joined #ruby
[18:10:01] DTZUZO: has joined #ruby
[18:12:40] deepredsky: has joined #ruby
[18:19:25] Net: NL3limin4t0r: thanks, that's great
[18:21:13] Net: as a more general question: what do you think of modules that are written to be included in a single class for the purpose of breaking a long class file into several files?
[18:21:37] Net: (not to write DRYer code)
[18:30:09] kyrylo: has joined #ruby
[18:36:15] NL3limin4t0r: Net: That is mostly done to group code together that has similar functionality or the same target. For example take ActiveRecord::Persistence https://github.com/rails/rails/blob/master/activerecord/lib/active_record/persistence.rb, which is only include in ActiveRecord::Base (as far as I can tell). This module contains code that effects persistence functionality of ActiveRecord::Base. On one hand this allows
[18:36:18] NL3limin4t0r: developers to stay sane and keep code organized, by not having a huge god class with everything mixed together. On the other hand it can be harder to navigate for developers that are not part of the project, and just want check out some source code. Like everything in life extracting code away in a module has pros and cons, weigh them before doing it yourself.
[18:40:49] NL3limin4t0r: You can always build your class and extract code away when you feel like it.
[18:48:49] conta: has joined #ruby
[19:01:02] Azure: has joined #ruby
[19:06:10] _whitelogger: has joined #ruby
[19:08:50] deepreds1: has joined #ruby
[19:09:08] miskatonic: has joined #ruby
[19:19:34] Exuma: has joined #ruby
[19:21:21] emptyfl4sk: has joined #ruby
[19:21:34] Net: NL3limin4t0r: arguably this pattern does not provide much over simply organizing code into sections in the main class
[19:22:13] Net: add code folding and it seems to be almost the same
[19:29:57] bjpenn: has joined #ruby
[19:29:59] bjpenn: has joined #ruby
[19:30:33] ellcs: has joined #ruby
[19:31:41] bjpenn: i have two ruby files, each containing a class. Just for simplicity, let's say `foo` and `bar` (i left out the .rb extension). in `bar` i have require_relative 'foo', but somehow I keep getting LaadError: cannot load such file -- path/to/foo
[19:31:47] bjpenn: they're both in the same directory
[19:32:12] bjpenn: is there something else i must do to get require_relative to work, aside from simply having the two files in the same directory?
[19:39:51] emptyfl4sk: has joined #ruby
[19:42:09] fphilipe: has joined #ruby
[19:45:02] havenwood: bjpenn: Maybe sanity check?: absolute_path = File.absolute_path 'foo', __dir__
[19:45:20] havenwood: bjpenn: realpath = File.realpath "#{absolute_path.chomp '.rb'}.rb"
[19:45:40] havenwood: bjpenn: Are absolute_path and realpath as expected?
[19:46:17] bjpenn: let me check that
[19:46:28] havenwood: bjpenn: The former is used for the LoadError and the latter to check against $LOADED_FEATURES.
[19:48:01] bjpenn: my file doesn't have .rb, so i guess for realpath = File.realpath "#{absolute_path.chomp '.rb'}.rb", i'll leave out the .rb?
[19:48:20] bjpenn: filename*
[19:49:26] havenwood: bjpenn: What's the extension?
[19:49:48] bjpenn: theres no extension, its just `foo`
[19:50:57] bjpenn: when i put this in `bar`, https://dpaste.de/n417
[19:51:13] bjpenn: it prints the smae path in both puts
[19:53:08] havenwood: bjpenn: It looks like my Ruby reproduction of #require_relative is faithful, in that it appends the .rb.
[19:55:01] bjpenn: it appends the .rb? both my paths show the foo without the .rb, because in the 2nd line of my paste (https://dpaste.de/n417), i didn't include last .rb from what yours had
[19:55:28] bjpenn: you mentioned this realpath = File.realpath "#{absolute_path.chomp '.rb'}.rb"
[19:55:31] bjpenn: i have this realpath = File.realpath "#{absolute_path.chomp '.rb'}"
[19:55:46] havenwood: bjpenn: Those two lines were just my attempt at mimicking what #require_relative does in pure Ruby.
[19:56:56] havenwood: bjpenn: I used it here (so you can enable TCO): https://gist.github.com/havenwood/3c5a5e1476c811460992
[19:57:38] bjpenn: regardless if i use chomp '.rb' or not, i still get the same path
[19:58:55] bjpenn: realpath = File.realpath "#{absolute_path}" <-- this is the same path as realpath = File.realpath "#{absolute_path.chomp '.rb'}"
[19:59:23] bjpenn: i feel like i dont know how to properly use require_relative
[19:59:23] havenwood: bjpenn: The missing .rb is the problem.
[19:59:32] bjpenn: oh really
[19:59:40] bjpenn: let me try
[19:59:42] havenwood: bjpenn: #require_relative is meant to work with .rb files
[19:59:57] havenwood: bjpenn: #require is fancy with “.so”, “.o”, or “.dll” as well.
[20:00:02] havenwood: bjpenn: #load doesn't care.
[20:00:15] havenwood: bjpenn: load 'foo'
[20:00:28] havenwood: bjpenn: or rename `foo` to `foo.rb` and: require_relative 'foo'
[20:01:06] havenwood: bjpenn: The only reason for the `chomp` is that `require_relative 'foo.rb'` is also valid.
[20:01:36] bjpenn: interesting.. yeah it works _after_ renaming it from foo to foo.rb
[20:01:40] havenwood: (It adds an .rb if there *isn't* one already.)
[20:01:42] bjpenn: the docs don't say this! :)
[20:02:43] havenwood: bjpenn: Very true...
[20:03:13] bjpenn: yes, load works well...
[20:03:41] havenwood: bjpenn: A difference with #load is it'll load multiple times (it disregards $LOADED_FEATURES).
[20:04:09] havenwood: Unlike #require and #require_relative, #load doesn't keep track of loaded files and will evaluate them each time they're loaded.
[20:04:30] bjpenn: that shouldnt be a problem for my case, since its a one off script, that gets run all over everytime it gets used anyway
[20:05:00] havenwood: bjpenn: You might even then: load f
[20:05:07] havenwood: bjpenn: You might even then: load 'foo', true
[20:05:26] bjpenn: yeah just use `load 'foo'` right?
[20:05:55] bjpenn: i think the other option is to rename the files to have .rb, which isnt the end ofthe world, but none of my files have the .rb extension
[20:06:00] havenwood: bjpenn: The second argument to #load provides an anonymous module as a namespace, just to make sure it won't stomp on any constant or local.
[20:06:01] bjpenn: i want to keep it consistent :)
[20:06:20] havenwood: bjpenn: load 'foo', anonymous_wrapper = true
[20:06:40] bjpenn: oh, .. looking into what that does
[20:07:46] bjpenn: what's the point of anonymous_wrapper?
[20:07:50] codefriar: has joined #ruby
[20:07:57] bjpenn: i can't find anything about that
[20:08:29] havenwood: bjpenn: You can set any local variables you want without accidentally stomping on something else set at top level. It insulates what you're loading from your top level namespace by wrapping it in a one-time module.
[20:12:25] bjpenn: thanks much havenwood
[20:12:38] havenwood: bjpenn: you're welcome
[20:13:22] Megamos: has joined #ruby
[20:13:32] cisco: has joined #ruby
[20:25:48] ellcs: has joined #ruby
[20:32:43] sarink: has joined #ruby
[20:39:34] ur5us: has joined #ruby
[20:41:05] Exuma: has joined #ruby
[20:41:17] akem-lnvo: has joined #ruby
[20:48:32] themsay: has joined #ruby
[21:01:06] lepepe: has joined #ruby
[21:07:19] lepepe_: has joined #ruby
[21:09:12] mahlon: has joined #ruby
[21:12:17] Exuma: has joined #ruby
[21:12:25] fphilipe: has joined #ruby
[21:14:23] sarink: has joined #ruby
[21:14:41] lepepe: has joined #ruby
[21:16:11] lepepe_: has joined #ruby
[21:16:52] deepredsky: has joined #ruby
[21:19:52] reber: has joined #ruby
[21:30:10] queip: has joined #ruby
[21:36:20] mkroman: has joined #ruby
[21:46:25] Azure: has joined #ruby
[21:47:46] fphilipe: has joined #ruby
[21:50:28] Exuma: has joined #ruby
[21:56:21] Azure: has joined #ruby
[21:59:44] sarink: has joined #ruby
[22:00:09] code_zombie: has joined #ruby
[22:00:52] DTZUZO: has joined #ruby
[22:09:35] lepepe: has joined #ruby
[22:14:59] Azure: has joined #ruby
[22:23:53] Azure: has joined #ruby
[22:29:25] ajamielittle: has joined #ruby
[22:29:59] fphilipe: has joined #ruby
[22:30:04] Azure: has joined #ruby
[22:39:22] Exuma: has joined #ruby
[22:45:05] sarink: has joined #ruby
[22:46:32] lepepe: has joined #ruby
[22:53:21] Dbugger: has joined #ruby
[22:54:47] AJA4350: has joined #ruby
[22:58:57] cd: has joined #ruby
[22:59:03] monika: has joined #ruby
[23:02:13] mistergibson: has joined #ruby
[23:06:15] emptyfl4sk: has joined #ruby
[23:11:30] monika: has left #ruby: ("WeeChat 2.5")
[23:19:32] canton7: has joined #ruby
[23:30:19] garyserj: &>> def abc x,y; end; abc 4,{"aa":"bb"} {}
[23:30:23] rubydoc: stderr: -e:2: syntax error, unexpected '{', expecting end (https://carc.in/#/r/772v)
[23:30:23] sarink: has joined #ruby
[23:30:46] garyserj: why can't I pass a block there?
[23:31:50] al2o3-cr: you need parens
[23:32:14] orbyt_: has joined #ruby
[23:37:23] garyserj: what's the rule re when passing a block requires parens?
[23:37:57] havenwood: garyserj: {/} and do/end have different precedence.
[23:38:12] havenwood: garyserj: the rule is precedence.
[23:38:47] havenwood: &>> def abc x,y; end; abc 4,{"aa":"bb"} do end
[23:38:48] rubydoc: # => nil (https://carc.in/#/r/772w)
[23:38:53] havenwood: garyserj: note that ^ works
[23:39:47] garyserj: oh yeah, ok, thanks
[23:40:25] garyserj: i knew i remembered passing a block without parens. was via do end
[23:41:21] queip: has joined #ruby
[23:41:27] garyserj: or a no parameter situation
[23:44:27] garyserj: And if i want to pass more than one hash then I need parens, unless it's a keyword argument, right?
[23:47:08] havenwood: garyserj: yes
[23:47:30] garyserj: and a keyword argument is not a hash, right?
[23:47:45] garyserj: (i'm aware that a hash can be automatically converted to a keyword argument)
[23:49:53] DaRock: has joined #ruby
[23:51:41] havenwood: garyserj: a real keyword argument is not a Hash. Ruby used to not have keyword arguments, and only had naked Hashes for arguments. now Ruby has some keyword argument support, but there's still ambiguity. in Ruby 3 there's a proposal for *real* keyword arguments not equivocal with Hashes.
[23:52:48] havenwood: garyserj: Here's a tracking ticket with some background reading: https://bugs.ruby-lang.org/issues/14183