« Back to channel list

#ruby - 09 January 2019

« Back 1 day Forward 1 day »
[00:00:42] rkazak: has joined #ruby
[00:02:52] virmagicis: has joined #ruby
[00:10:57] Renich: has joined #ruby
[00:14:25] tiff: has joined #ruby
[00:15:28] uplime: has joined #ruby
[00:20:03] hutch: has joined #ruby
[00:29:57] themsay: has joined #ruby
[00:35:04] hutch: has joined #ruby
[00:39:58] decal: has joined #ruby
[00:44:39] SuperLag: has joined #ruby
[00:51:23] rkazak: has joined #ruby
[00:52:45] kent\n: has joined #ruby
[00:59:02] orbyt_: has joined #ruby
[01:05:49] tdy: has joined #ruby
[01:09:33] davidw: has joined #ruby
[01:10:41] armyriad: has joined #ruby
[01:13:51] bga57: has joined #ruby
[01:29:34] ua_: has joined #ruby
[01:53:35] tdy: has joined #ruby
[02:03:00] orbyt_: has joined #ruby
[02:11:25] conta: has joined #ruby
[02:15:10] _whitelogger: has joined #ruby
[02:31:15] cschneid: has joined #ruby
[02:41:20] orbyt_: has joined #ruby
[02:49:27] esrse: has joined #ruby
[02:56:04] tdy: has joined #ruby
[02:56:05] bmurt: has joined #ruby
[03:20:49] hutch: has joined #ruby
[03:27:52] Swyper: has joined #ruby
[03:47:25] asphyxia: has joined #ruby
[03:54:19] conta: has joined #ruby
[04:00:37] orbyt_: has joined #ruby
[04:06:44] KeyJoo: has joined #ruby
[04:08:00] nertzy: has joined #ruby
[04:10:19] braincrash: has joined #ruby
[04:23:20] hutch: has joined #ruby
[04:35:57] sauvin: has joined #ruby
[04:43:12] TomyLobo: has joined #ruby
[04:50:20] indocomsoft: has joined #ruby
[04:52:31] davidw: has joined #ruby
[04:53:50] tdy1: has joined #ruby
[04:54:05] lytol_: has joined #ruby
[04:55:42] cnsvc: has joined #ruby
[04:57:12] badeball1: has joined #ruby
[04:57:15] Puffball_: has joined #ruby
[04:58:25] yokel_: has joined #ruby
[05:00:21] r29v: has joined #ruby
[05:00:42] lghtstkr: has joined #ruby
[05:02:51] bvdw: has joined #ruby
[05:03:57] Paraxial: has joined #ruby
[05:10:42] duderonomy: has joined #ruby
[05:25:03] cschneid: has joined #ruby
[05:32:16] hutch: has joined #ruby
[05:48:04] dinfuehr: has joined #ruby
[05:52:41] marmotini_: has joined #ruby
[05:58:17] dinfuehr: has joined #ruby
[06:01:26] marmotini_: has joined #ruby
[06:01:58] dinfuehr_: has joined #ruby
[06:06:07] Tempesta: has joined #ruby
[06:09:07] dinfuehr: has joined #ruby
[06:11:28] za1b1tsu: has joined #ruby
[06:11:41] orbyt_: has joined #ruby
[06:19:46] maufart__: has joined #ruby
[06:21:29] conta: has joined #ruby
[06:21:40] ansraliant: has joined #ruby
[06:24:20] dinfuehr: has joined #ruby
[06:27:38] dinfuehr_: has joined #ruby
[06:34:36] dinfuehr: has joined #ruby
[06:34:53] jgnagy: has joined #ruby
[06:37:03] jgnagy: has joined #ruby
[06:38:51] mikecmpbll: has joined #ruby
[06:42:09] dinfuehr: has joined #ruby
[06:43:19] themsay: has joined #ruby
[06:53:42] dinfuehr: has joined #ruby
[06:53:48] marmotini_: has joined #ruby
[06:55:54] cschneid: has joined #ruby
[06:59:49] themsay: has joined #ruby
[07:00:42] dinfuehr: has joined #ruby
[07:05:48] dinfuehr: has joined #ruby
[07:18:13] marmotini_: has joined #ruby
[07:40:36] profetes: has joined #ruby
[07:42:44] marmotini_: has joined #ruby
[07:48:43] drale2k_: has joined #ruby
[08:00:42] d^sh_: has joined #ruby
[08:07:55] drale2k_: has joined #ruby
[08:09:31] drale2k_: has joined #ruby
[08:13:20] clemens3: has joined #ruby
[08:14:10] za1b1tsu: Anyone using reek as a linter. So I have this method in a module. The module is a collection of methods that generate random data and the method generates a random letter. Reek complains about: UtilityFunction
[08:14:30] za1b1tsu: I mean a UtilityFunction should be in a module, correct? Where should I put it then
[08:15:51] za1b1tsu: ah it wans self.method, ok kidna makes sense
[08:29:59] cnsvc: has joined #ruby
[08:32:33] s2013: has joined #ruby
[08:33:43] marmotini_: has joined #ruby
[08:44:43] marmotini_: has joined #ruby
[08:45:55] jmcgnh: has joined #ruby
[08:53:08] mikecmpbll: has joined #ruby
[08:55:54] nowhere_man: has joined #ruby
[09:01:28] n13z: has joined #ruby
[09:05:23] vondruch: has joined #ruby
[09:10:06] za1b1tsu: I'm researching best practises to use custom errors, and I see that usually they are put in lib/my_app/exceptions.rb
[09:10:56] za1b1tsu: but what if an exception is tied to a certain module/class, do I define the exception in the module/class definition or do I still put in lib/my_app/exceptions.rb?
[09:13:11] mikecmpbll: has joined #ruby
[09:19:51] vondruch: has joined #ruby
[09:21:56] tbuehlmann: za1b1tsu: up to you really, I think both options are good ones
[09:22:46] dionysus69: has joined #ruby
[09:23:20] za1b1tsu: tbuehlmann, I really like the idea of lib/my_app/exceptions.rb instead of having exceptions all other the place. But this means I should have more generic error classes
[09:26:26] yokel: has joined #ruby
[09:34:37] lxsameer: has joined #ruby
[09:34:59] clemens3: has joined #ruby
[09:36:34] jsrn: has joined #ruby
[09:38:28] RougeR: has joined #ruby
[09:42:03] clemens3: has joined #ruby
[09:44:24] Nicmavr: has joined #ruby
[09:56:26] cschneid: has joined #ruby
[10:00:05] Dbugger: has joined #ruby
[10:00:05] RougeRR: has joined #ruby
[10:19:05] clemens3: has joined #ruby
[10:28:04] ziyadb: has joined #ruby
[10:43:32] ldnunes: has joined #ruby
[11:07:12] RougeR: has joined #ruby
[11:16:23] troulouliou_div2: has joined #ruby
[11:18:33] RougeR: can anyone explain why this doesnt work
[11:18:37] RougeR: result.dig(:work, :workers) += 1
[11:18:45] RougeR: the value its incrementing is an integer
[11:18:50] RougeR: it also works if i dont use dig
[11:20:45] canton7: RougeR, for the same reason that 'workers = result.dig(:work, :workers); workers += `' "doesn't work"
[11:21:09] canton7: in that it increments the 'workers' variable, not the value of result[:work][:workers]
[11:22:03] maetthew: has left #ruby: ("Leaving")
[11:24:03] Flonk: has joined #ruby
[11:25:55] cschneid: has joined #ruby
[11:31:05] phaul: &>> a = [1,2]; b = a; a += [3]; [a, b]
[11:31:06] badeball: has joined #ruby
[11:31:09] rubydoc: # => [[1, 2, 3], [1, 2]] (https://carc.in/#/r/5yft)
[11:33:12] RedNifre: has joined #ruby
[11:35:45] phaul: so as canton7 said. Plus apart from += doesn't modify as it's just a shorthand for .. = .. + .., integers cannot be modified anyway. there is no way to monkey patch a method into Integer that modifies the value of self
[11:37:01] canton7: but, there's no need for dig here. Just do 'result[:work][:workers] += 1'
[11:38:18] InfinityFye: has joined #ruby
[11:41:30] RedNifre: has joined #ruby
[11:45:42] badeball: has joined #ruby
[11:58:30] phaul: there must be a further magic that makes that work. namely it calls []=. because [] returns the same object as dig, so there is no difference there.
[12:02:02] vondruch_: has joined #ruby
[12:03:50] canton7: well, '+=' will expand to 'result[:work][:workers] = result[:work][:workers] + 1'
[12:08:10] troulouliou_div2: has joined #ruby
[12:10:01] phaul: yeah, it's quite invlolved. (result.[](:work)).[]=(:workers, (result.[](:work)).[](:workers).+(1))) if im parsing it correctly
[12:10:36] phaul: &ast>> result[:workers][:work] += 1
[12:10:38] rubydoc: I have parsed your code, the result is at https://carc.in/#/r/5yfy
[12:11:00] phaul: ast doesn't expand it
[12:17:52] fiachetti: has joined #ruby
[12:25:35] lxsameer: has joined #ruby
[12:25:37] nertzy: has joined #ruby
[12:25:56] armyriad: has joined #ruby
[12:26:53] lucasb: has joined #ruby
[12:33:14] vondruch: has joined #ruby
[12:34:48] donofrio: has joined #ruby
[12:41:01] reber: has joined #ruby
[12:42:53] troulouliou_div2: has joined #ruby
[12:45:04] bmurt: has joined #ruby
[13:01:08] Emmanuel_Chanel: has joined #ruby
[13:03:42] lxsameer: has joined #ruby
[13:22:11] sarink: has joined #ruby
[13:37:45] themsay: has joined #ruby
[13:49:25] davidw: has joined #ruby
[13:53:18] krawchyk: has joined #ruby
[14:11:16] conta: has joined #ruby
[14:13:09] johnny56_: has joined #ruby
[14:19:20] dviola: has joined #ruby
[14:25:29] clemens3: has joined #ruby
[14:26:06] cschneid: has joined #ruby
[14:27:48] saTchymoto: has joined #ruby
[14:28:20] conta: has joined #ruby
[14:34:14] jordanm: has joined #ruby
[14:45:43] grvgr: has joined #ruby
[14:53:31] Rapture: has joined #ruby
[14:56:59] gnufied: has joined #ruby
[14:58:28] vondruch_: has joined #ruby
[14:58:33] chouhoulis: has joined #ruby
[15:01:12] Inline: has joined #ruby
[15:01:36] za1b1tsu: has joined #ruby
[15:02:40] Emmanuel_Chanel: has joined #ruby
[15:03:03] cschneid: has joined #ruby
[15:06:56] DTZUZO: has joined #ruby
[15:08:14] sarink: has joined #ruby
[15:08:29] uplime: has joined #ruby
[15:11:14] maryo: has joined #ruby
[15:13:11] Emmanuel_Chanel: has joined #ruby
[15:23:05] rippa: has joined #ruby
[15:26:34] RougeR: any resque/redis experts here?
[15:26:54] SeepingN: has joined #ruby
[15:27:08] conta: has joined #ruby
[15:27:09] RougeR: trying to get a worker to register its queue as a key in redis when it is brought online
[15:30:43] RedNifre: has joined #ruby
[15:32:08] dalpo: has joined #ruby
[15:44:29] chouhoulis: has joined #ruby
[15:45:43] polishdub: has joined #ruby
[15:45:55] cschneid: has joined #ruby
[15:46:44] vondruch: has joined #ruby
[15:47:22] cschneid: has joined #ruby
[15:50:00] uplime: has joined #ruby
[15:51:51] GodFather: has joined #ruby
[15:55:44] Renich: has joined #ruby
[16:01:07] hutch: has joined #ruby
[16:01:33] sarink: has joined #ruby
[16:01:50] dinfuehr: has joined #ruby
[16:02:40] tdy1: has joined #ruby
[16:09:09] cow[moo]: has joined #ruby
[16:10:57] Renich: has joined #ruby
[16:15:48] kidPalooma: has joined #ruby
[16:20:10] davidw: has joined #ruby
[16:21:46] dviola: has joined #ruby
[16:26:12] Sylario: has joined #ruby
[16:26:35] cthulchu_: has joined #ruby
[16:26:44] dviola: I've wrote some code to "normalize" some text but I'm not exactly proud of my normalize method, I was wondering if I can get some help :P
[16:26:46] dviola: https://gist.github.com/diegoviola/56e55384569182a1ab3aa97d4d96a70d
[16:27:10] dviola: it does work but I'm out of ideas how to make it better
[16:27:33] dviola: People#normalize
[16:31:09] krawchyk: has joined #ruby
[16:31:22] mspo: yeah seems kind of repeat-y
[16:31:33] dviola: mostly I'm trying to refactor this method because I'm calling #each 5 times, it feels kinda wrong
[16:33:10] havenwood: dviola: Are all keys either `:comma` or `:dollar`?
[16:33:38] dviola: havenwood: yes
[16:34:20] nowhere_man: has joined #ruby
[16:35:25] mspo: but the order is different depending
[16:35:59] mspo: you could make the method take the field mapping as a parameter
[16:36:56] mspo: then it would be, like, if $ normalize {name => 2, city => 4, ..} ?
[16:37:31] mspo: but each field would need its own normalizing method too
[16:37:37] mspo: since you have that trick on date
[16:38:35] r29v: has joined #ruby
[16:48:40] dviola: I changed it to this: https://gist.github.com/diegoviola/f9fed0e74fe286a5430b0249a569e601
[16:50:08] \void: has joined #ruby
[16:50:22] go|dfish: has joined #ruby
[16:57:33] gnufied: has joined #ruby
[17:08:14] stryek: has joined #ruby
[17:09:37] mkroman: has joined #ruby
[17:10:36] krawchyk: has joined #ruby
[17:16:56] nowhere_man: has joined #ruby
[17:19:35] phaul: dviola: you might not even like this rewrite, but my attempt: https://gist.github.com/phaul/be4256516ee5c0917fb57eded580303d
[17:21:24] krawchyk: has joined #ruby
[17:26:29] dviola: phaul: interesting, it's nice
[17:26:37] dviola: I like the way you separated the values with name_source, etc
[17:27:43] duderonomy: has joined #ruby
[17:33:17] urbanmonk: has joined #ruby
[17:34:02] phaul: dviola: I made my changes mainly following the ideas from here: https://www.deconstructconf.com/2018/sandi-metz-polly-want-a-message
[17:36:15] fmccann: has joined #ruby
[17:43:29] havenwood: dviola: I agree with the extract method refactoring. You might consider Regexp with named captures. Something like: https://dpaste.de/7BDT
[17:43:37] mikecmpbll: has joined #ruby
[17:45:22] havenwood: dviola: I think it'd be nicer to assign @result to the return value of #flat_map and #map rather than shoveling.
[17:47:32] dviola: yeah I feel it's better with the regex
[17:58:24] mozzarella: do you guys use/like crystal?
[18:00:43] sanscoeur: has joined #ruby
[18:02:53] Rapture_: has joined #ruby
[18:10:11] orbyt_: has joined #ruby
[18:11:54] Aqo: has joined #ruby
[18:13:49] conta: has joined #ruby
[18:14:36] conta1: has joined #ruby
[18:21:08] chouhoulis: has joined #ruby
[18:31:01] Dbugger: has joined #ruby
[18:31:10] zenogais: has joined #ruby
[18:31:46] chamunks: has joined #ruby
[18:34:50] mspo: is there a nicer way to do this part? https://gist.github.com/phaul/be4256516ee5c0917fb57eded580303d#file-x-rb-L26
[18:34:51] krawchyk: has joined #ruby
[18:35:00] s2013: has joined #ruby
[18:36:46] Eiam: lol what the hell
[18:36:46] Eiam: https://github.com/nahi/logger/issues/3
[18:37:03] phaul: mspo: Sandi calls these or wrapper objects of these factories, and she talks about pushing the conditional out as far as possible (out or up the stack). But she can't avoid having them
[18:38:47] Eiam: come back from holiday and super old shit fails to deploy now thanks bud
[18:38:50] mspo: phaul: bummer
[18:39:38] mozzarella: mspo: you mean syntactically?
[18:39:44] mozzarella: { comma: CommaPerson.new, dollar: DollarPerson.new }[key]
[18:40:04] mspo: mozzarella: I mean it's a lot of layers
[18:40:43] mozzarella: I haven't been following the conversation so I'm not sure what you're doing
[18:42:47] phaul: mspo, undeniably we introduce more classes and more complexity at the surface level, in exchange eliminating all conditional code paths from everywhere, apart from 1 top level factory dispatch
[18:43:21] phaul: same as null pattern just applied for every if not just nil?
[18:47:23] phaul: alhtough I don't agree with sandi that this should be applied all the time, but in her example and here as well I think it fits
[18:47:30] irdr: has joined #ruby
[18:51:53] orbyt_: has joined #ruby
[18:55:24] Renich: has joined #ruby
[18:57:08] sameerynho: has joined #ruby
[18:57:26] jcarl43: has joined #ruby
[19:02:23] Eldritch: has joined #ruby
[19:02:39] tdy1: has joined #ruby
[19:20:20] sanscoeur: has joined #ruby
[19:27:21] gix: has joined #ruby
[19:29:04] haylon: has joined #ruby
[19:30:24] haylon: has joined #ruby
[19:32:41] sanscoeur: has joined #ruby
[20:00:48] skryking: has joined #ruby
[20:01:00] sanscoeur: has joined #ruby
[20:04:35] RougeR: has joined #ruby
[20:06:16] Swyper: has joined #ruby
[20:10:00] ur5us: has joined #ruby
[20:12:24] hutch: has joined #ruby
[20:15:21] zenogais: has joined #ruby
[20:25:24] twobitsprite: has joined #ruby
[20:25:32] Nicmavr: has joined #ruby
[20:26:26] twobitsprite: Can Rakefiles be aware of non-file target such as docker images, etc? I'm considering moving away from Makefiles, and one of the things I have to do in make is touch files after building images so make can know what needs to be rebuilt.
[20:27:02] uplime: has joined #ruby
[20:35:03] GodFather: has joined #ruby
[20:41:29] Sou|cutter: has joined #ruby
[20:44:31] troulouliou_dev: has joined #ruby
[20:56:10] grvgr: has joined #ruby
[20:58:56] orbyt_: has joined #ruby
[20:59:41] jinie: has joined #ruby
[21:02:47] orbyt_: has joined #ruby
[21:12:13] ellcs: has joined #ruby
[21:13:49] profetes: has joined #ruby
[21:18:34] cow[moo]: has joined #ruby
[21:23:05] grvgr_: has joined #ruby
[21:28:14] raulp: has joined #ruby
[21:29:12] powerbit: has joined #ruby
[21:47:11] grvgr_: has joined #ruby
[21:47:33] funnel: has joined #ruby
[21:52:37] lxsameer: has joined #ruby
[21:55:31] ellcs: has joined #ruby
[22:14:52] r29v: has joined #ruby
[22:22:53] tdy1: has joined #ruby
[22:44:20] al2o3-cr: has joined #ruby
[22:48:32] orbyt_: has joined #ruby
[22:49:41] akem: has joined #ruby
[22:53:00] duderonomy: has joined #ruby
[23:07:10] grvgr_: has joined #ruby
[23:17:08] Swyper: has joined #ruby
[23:23:24] GodFather: has joined #ruby
[23:28:12] cschneid: has joined #ruby
[23:29:36] chouhoulis: has joined #ruby
[23:31:46] mozzarella: has joined #ruby
[23:33:11] sarink: has joined #ruby
[23:36:07] GodFather: has joined #ruby
[23:41:58] chouhoulis: has joined #ruby
[23:46:20] chouhoulis: has joined #ruby
[23:47:39] SeepingN: Has there been a change in ruby/rails around ruby 2.2.3 where the console no longer returns a value for something unless you use puts to print it out?
[23:48:53] baweaver: SeepingN: no?
[23:49:07] baweaver: Do you have an example?
[23:49:36] baweaver: Works in 2.3, 2.4, 2.5, and 2.6.
[23:49:43] baweaver: Not sure what you're seeing.
[23:49:47] SeepingN: Used to get the value back (=> 2). Now I just get empty result (=> )
[23:49:56] SeepingN: unless it's a string
[23:50:05] SeepingN: irb(main):015:0> 1+1
[23:50:05] SeepingN: irb(main):016:0> "wow"
[23:50:22] baweaver: What version of Ruby are you using?
[23:50:33] SeepingN: 2.2.3 according to RUBY_VERSION
[23:50:50] baweaver: 2.6.0 :001 > RUBY_VERSION
[23:50:50] chouhoulis: has joined #ruby
[23:50:50] baweaver: 2.6.0 :002 > 1 + 1
[23:51:17] baweaver: 2.5.1 :001 > RUBY_VERSION
[23:51:18] baweaver: 2.5.1 :002 > 1 + 1
[23:51:52] baweaver: I think something's screwy with your ruby install
[23:52:06] SeepingN: conf.echo is true... thinking maybe someone else in engineering changed it
[23:52:07] baweaver: That, and 2.2.x is super out of date
[23:52:24] SeepingN: well there's that too, yes. we just switched our team to india too, so
[23:52:32] SeepingN: ..going to be old for a while I imagine
[23:55:21] chouhoulis: has joined #ruby
[23:56:46] SeepingN: it will print out objects too, such as User.last