« Back to channel list

#ruby - 05 March 2018

« Back 1 day Forward 1 day »
[00:00:57] itp_student|1913: has joined #ruby
[00:05:27] dmitriy_: has joined #ruby
[00:12:56] itp_student|1913: has joined #ruby
[00:17:37] maum: has joined #ruby
[00:18:06] itp_student|1913: has joined #ruby
[00:18:30] zenspider: anyone know of good formula to generate color gradients through the full spectrum? I want really smooth gradients w/ 12_000 unique values.
[00:18:46] Azure: has joined #ruby
[00:20:42] SynSynack: has joined #ruby
[00:20:57] itp_student|1913: has joined #ruby
[00:24:57] itp_student|1913: has joined #ruby
[00:26:24] cschneid: has joined #ruby
[00:27:00] jenrzzz: has joined #ruby
[00:32:10] konsolebox: has joined #ruby
[00:33:38] itp_student|1913: has joined #ruby
[00:36:07] adlerdias: has joined #ruby
[00:38:44] adlerdias: has joined #ruby
[00:39:40] hahuang61: has joined #ruby
[00:40:31] nowhereman_: has joined #ruby
[00:42:12] konsolebox: has joined #ruby
[00:44:33] dviola: has joined #ruby
[00:51:06] ogres: has joined #ruby
[00:56:01] nowhereman_: has joined #ruby
[01:03:09] knight33: has joined #ruby
[01:13:30] hahuang61: has joined #ruby
[01:20:46] mjolnird: has joined #ruby
[01:21:44] GodFather: has joined #ruby
[01:22:58] cschneid: has joined #ruby
[01:30:53] hahuang65: has joined #ruby
[01:43:18] hahuang65: has joined #ruby
[02:05:45] lexruee: has joined #ruby
[02:16:33] vutral|kali: has joined #ruby
[02:16:33] vutral|kali: has joined #ruby
[02:17:10] GodFather: has joined #ruby
[02:17:54] AJA4350: has joined #ruby
[02:19:33] hahuang65: has joined #ruby
[02:23:35] hahuang65: has joined #ruby
[02:28:02] GodFather: has joined #ruby
[02:33:12] dinfuehr: has joined #ruby
[02:37:57] hahuang65: has joined #ruby
[02:38:31] vutral|kali: has joined #ruby
[02:38:31] vutral|kali: has joined #ruby
[02:38:49] bmurt: has joined #ruby
[02:40:27] arescorpio: has joined #ruby
[02:41:11] hahuang61: has joined #ruby
[02:43:59] hahuang65: has joined #ruby
[02:45:23] hahuang65: has joined #ruby
[02:48:30] vutral|kali: has joined #ruby
[02:48:31] vutral|kali: has joined #ruby
[02:51:50] hahuang65: has joined #ruby
[02:53:10] guacamole: has joined #ruby
[02:53:10] guacamole: has joined #ruby
[02:53:33] hahuang65: has joined #ruby
[02:55:43] hahuang65: has joined #ruby
[02:55:54] gizmore: has joined #ruby
[03:00:09] cadillac_: has joined #ruby
[03:05:42] GodFather: has joined #ruby
[03:08:17] cdg: has joined #ruby
[03:08:26] bigblind: has joined #ruby
[03:11:31] cpallares: has joined #ruby
[03:12:13] hahuang65: has joined #ruby
[03:16:13] SteenJobs: has joined #ruby
[03:19:08] ledestin: has joined #ruby
[03:19:21] vutral|kali: has joined #ruby
[03:19:22] vutral|kali: has joined #ruby
[03:20:05] hahuang65: has joined #ruby
[03:24:38] jottr: has joined #ruby
[03:25:17] hahuang65: has joined #ruby
[03:27:22] cdg: has joined #ruby
[03:30:23] guacamole: has joined #ruby
[03:30:23] guacamole: has joined #ruby
[03:30:54] Mr_Tea: has joined #ruby
[03:31:40] Mr_Tea: how do I get a keypress without halting execution?
[03:35:17] hahuang61: has joined #ruby
[03:41:46] hahuang65: has joined #ruby
[03:45:03] cpallares: has joined #ruby
[03:46:43] vutral|kali: has joined #ruby
[03:46:43] vutral|kali: has joined #ruby
[03:47:58] orbyt_: has joined #ruby
[03:49:36] Mr_Tea: has joined #ruby
[03:50:49] cschneid: has joined #ruby
[03:52:51] Map: has joined #ruby
[03:55:05] IanMalcolm: has joined #ruby
[03:55:11] cpallares: has joined #ruby
[03:55:21] govg: has joined #ruby
[03:56:56] Eldritch: has joined #ruby
[03:57:26] Eldritch: has joined #ruby
[04:02:25] guacamole: has joined #ruby
[04:02:25] guacamole: has joined #ruby
[04:03:29] milardovich: has joined #ruby
[04:07:20] vutral|kali: has joined #ruby
[04:07:20] vutral|kali: has joined #ruby
[04:11:24] bigblind: has joined #ruby
[04:15:16] vutral|kali: has joined #ruby
[04:15:17] vutral|kali: has joined #ruby
[04:19:34] Mr_Tea: has joined #ruby
[04:19:59] darkhanb: has joined #ruby
[04:22:25] darkhanb: has joined #ruby
[04:25:15] trautwein: has joined #ruby
[04:26:14] havenwood: require 'io/console'; $stdin.getch
[04:40:18] hahuang61: has joined #ruby
[04:41:43] vutral|kali: has joined #ruby
[04:41:43] vutral|kali: has joined #ruby
[04:44:04] konsolebox: has joined #ruby
[04:44:42] vutral|kali: has joined #ruby
[04:44:42] vutral|kali: has joined #ruby
[04:45:52] havenwood: <3 https://github.com/ruby/ruby/commit/b1a8c64483b5ba5e4a391aa68234e7bde6355034
[04:46:33] IanMalcolm: has joined #ruby
[04:47:44] cpallares: has joined #ruby
[04:48:14] darkhanb: has joined #ruby
[04:49:39] pastorinni: has joined #ruby
[04:51:33] eckhardt: has joined #ruby
[04:55:28] Eldritch: has joined #ruby
[04:56:24] Eldritch: has joined #ruby
[05:00:31] bonhoeffer: has joined #ruby
[05:02:26] dtzuzu: has joined #ruby
[05:03:58] jenrzzz: has joined #ruby
[05:04:03] bonhoeffer: has joined #ruby
[05:06:28] bigblind: has joined #ruby
[05:07:37] konsolebox: has joined #ruby
[05:07:41] bonhoeffer: has joined #ruby
[05:08:58] luminous: has joined #ruby
[05:11:07] bonhoeffer: has joined #ruby
[05:12:35] hahuang61: has joined #ruby
[05:14:38] bonhoeffer: has joined #ruby
[05:17:36] k-factor: has joined #ruby
[05:18:07] bonhoeffer: has joined #ruby
[05:18:37] LocaMocha: has joined #ruby
[05:18:52] k-factor: has left #ruby: ()
[05:21:44] bonhoeffer: has joined #ruby
[05:25:10] bonhoeffer: has joined #ruby
[05:25:48] rippa: has joined #ruby
[05:27:00] GodOfSea: has joined #ruby
[05:27:33] LocaMocha: has joined #ruby
[05:28:49] bonhoeffer: has joined #ruby
[05:29:19] GodOfSea: I am getting a psych error everytime I do bundle exec rake db:migrate RAILS_ENV=production
[05:29:46] GodOfSea: I checked all the yml files for errors but there are none
[05:30:00] GodOfSea: i am getting a psych syntax error
[05:31:07] GodOfSea: I have been scratching my head for the past 3 hours
[05:32:09] bonhoeffer: has joined #ruby
[05:35:05] konsolebox: has joined #ruby
[05:35:28] sidx64: has joined #ruby
[05:35:43] bonhoeffer: has joined #ruby
[05:38:05] vondruch: has joined #ruby
[05:39:00] eckhardt: has joined #ruby
[05:39:13] bonhoeffer: has joined #ruby
[05:40:54] Ryzokuken: has joined #ruby
[05:41:01] jottr: has joined #ruby
[05:41:11] cthulchu_: has joined #ruby
[05:41:33] havenwood: ?rails GodOfSea
[05:41:33] ruby[bot]: GodOfSea: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[05:41:44] havenwood: GodOfSea: Show the full error?
[05:42:25] cpallares: has joined #ruby
[05:42:45] darkhanb: has joined #ruby
[05:42:57] bonhoeffer: has joined #ruby
[05:45:27] jamesaxl: has joined #ruby
[05:45:42] GodOfSea: havenwood https://pastebin.com/8mMYQrKt
[05:45:44] ruby[bot]: GodOfSea: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/cb90c1b14482b3d60ccf528af7677af1
[05:45:44] ruby[bot]: GodOfSea: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[05:45:59] IanMalcolm: has joined #ruby
[05:46:15] bonhoeffer: has joined #ruby
[05:49:43] bonhoeffer: has joined #ruby
[05:50:43] orbyt_: has joined #ruby
[05:50:59] darkhanb: has joined #ruby
[05:52:26] Eldritch: has joined #ruby
[05:53:15] bonhoeffer: has joined #ruby
[05:55:51] Eldritch: has joined #ruby
[05:56:47] bonhoeffer: has joined #ruby
[05:58:25] tAn: has joined #ruby
[06:00:19] bonhoeffer: has joined #ruby
[06:03:50] bonhoeffer: has joined #ruby
[06:04:35] PhoenixMage: has joined #ruby
[06:07:21] bonhoeffer: has joined #ruby
[06:11:04] bonhoeffer: has joined #ruby
[06:14:30] bonhoeffer: has joined #ruby
[06:14:33] Ryzokuken: has joined #ruby
[06:14:55] DTZUZO: has joined #ruby
[06:17:17] cdg: has joined #ruby
[06:17:55] bonhoeffer: has joined #ruby
[06:19:36] jottr: has joined #ruby
[06:21:25] bonhoeffer: has joined #ruby
[06:21:40] DTZUZO: has joined #ruby
[06:23:00] nadir: has joined #ruby
[06:24:58] bonhoeffer: has joined #ruby
[06:25:00] ryzokuken13: has joined #ruby
[06:26:15] dtzuzu: has joined #ruby
[06:28:24] bonhoeffer: has joined #ruby
[06:30:21] aufi: has joined #ruby
[06:32:08] bonhoeffer: has joined #ruby
[06:32:18] eckhardt: has joined #ruby
[06:35:33] bonhoeffer: has joined #ruby
[06:35:49] Xiti: has joined #ruby
[06:39:04] bonhoeffer: has joined #ruby
[06:41:17] hahuang61: has joined #ruby
[06:41:50] Cohedrin: has joined #ruby
[06:42:16] aufi: has joined #ruby
[06:42:32] bonhoeffer: has joined #ruby
[06:45:15] IanMalcolm: has joined #ruby
[06:45:49] sidx64: has joined #ruby
[06:45:59] bonhoeffer: has joined #ruby
[06:47:55] n008f4g_: has joined #ruby
[06:49:32] bonhoeffer: has joined #ruby
[06:53:02] bonhoeffer: has joined #ruby
[06:55:29] bigblind: has joined #ruby
[06:56:33] bonhoeffer: has joined #ruby
[07:00:07] bonhoeffer: has joined #ruby
[07:03:46] sidx64: has joined #ruby
[07:03:48] bonhoeffer: has joined #ruby
[07:07:07] phate408: has joined #ruby
[07:07:09] bonhoeffer: has joined #ruby
[07:10:38] bonhoeffer: has joined #ruby
[07:12:18] KeyJoo: has joined #ruby
[07:12:32] sidx64_: has joined #ruby
[07:14:09] bonhoeffer: has joined #ruby
[07:16:50] amatas: has joined #ruby
[07:17:47] jottr: has joined #ruby
[07:17:51] bonhoeffer: has joined #ruby
[07:19:29] cschneid: has joined #ruby
[07:20:55] DTZUZO: has joined #ruby
[07:21:13] bonhoeffer: has joined #ruby
[07:22:58] sidx64: has joined #ruby
[07:24:40] bonhoeffer: has joined #ruby
[07:28:23] dionysus69: has joined #ruby
[07:28:45] bonhoeffer: has joined #ruby
[07:29:36] DTZUZO: has joined #ruby
[07:29:47] dtzuzu: has joined #ruby
[07:32:15] bonhoeffer: has joined #ruby
[07:34:17] sidx64: has joined #ruby
[07:35:12] suukim: has joined #ruby
[07:35:45] bonhoeffer: has joined #ruby
[07:36:18] conta: has joined #ruby
[07:39:01] hahuang61: has joined #ruby
[07:39:16] bonhoeffer: has joined #ruby
[07:42:55] bonhoeffer: has joined #ruby
[07:43:05] cadillac_: has joined #ruby
[07:46:17] bonhoeffer: has joined #ruby
[07:49:46] bonhoeffer: has joined #ruby
[07:52:49] guardianx: has joined #ruby
[07:53:19] Dimik: has joined #ruby
[07:53:21] bonhoeffer: has joined #ruby
[07:54:12] schneider: has joined #ruby
[07:55:05] andikr: has joined #ruby
[07:56:56] bonhoeffer: has joined #ruby
[08:00:19] bonhoeffer: has joined #ruby
[08:03:53] bonhoeffer: has joined #ruby
[08:07:32] bonhoeffer: has joined #ruby
[08:10:38] karapetyan: has joined #ruby
[08:11:10] clemens3: has joined #ruby
[08:12:27] bonhoeffer: has joined #ruby
[08:14:13] yeshurun: has joined #ruby
[08:14:20] yeshurun: has left #ruby: ()
[08:15:33] bigblind: has joined #ruby
[08:15:58] bonhoeffer: has joined #ruby
[08:19:29] bonhoeffer: has joined #ruby
[08:22:59] bonhoeffer: has joined #ruby
[08:23:35] KramerC: has joined #ruby
[08:24:19] vondruch: has joined #ruby
[08:26:27] bonhoeffer: has joined #ruby
[08:27:43] schneider: has joined #ruby
[08:28:57] vondruch: has joined #ruby
[08:29:43] devil_tux: has joined #ruby
[08:30:06] devil_tux: has joined #ruby
[08:30:09] bonhoeffer: has joined #ruby
[08:31:40] burgestrand: has joined #ruby
[08:33:31] bonhoeffer: has joined #ruby
[08:36:37] Ryzokuken: has joined #ruby
[08:36:54] hahuang61: has joined #ruby
[08:37:02] bonhoeffer: has joined #ruby
[08:40:42] bonhoeffer: has joined #ruby
[08:44:04] bonhoeffer: has joined #ruby
[08:44:23] mtkd: has joined #ruby
[08:45:40] sidx64: has joined #ruby
[08:47:37] karapetyan: has joined #ruby
[08:47:45] bonhoeffer: has joined #ruby
[08:49:17] vikas027: has joined #ruby
[08:50:25] vikas027: Hey All, Can someone pls help me why my script is not working with bundle but working otherwise https://dpaste.de/asLt Strangely, this behavior is only on Alpine not OSX
[08:51:08] bonhoeffer: has joined #ruby
[08:54:15] TomyWork: has joined #ruby
[08:54:42] bonhoeffer: has joined #ruby
[08:55:26] sidx64: has joined #ruby
[08:57:39] bauruine: has joined #ruby
[08:58:13] bonhoeffer: has joined #ruby
[08:59:27] roshanavand: has joined #ruby
[09:01:38] bonhoeffer: has joined #ruby
[09:05:07] bonhoeffer: has joined #ruby
[09:05:31] aupadhye: has joined #ruby
[09:06:57] claudiuinberlin: has joined #ruby
[09:08:37] bonhoeffer: has joined #ruby
[09:09:09] bigblind: has joined #ruby
[09:12:19] bonhoeffer: has joined #ruby
[09:15:43] bonhoeffer: has joined #ruby
[09:16:25] kapil___: has joined #ruby
[09:19:14] bonhoeffer: has joined #ruby
[09:19:51] ohcibi: has joined #ruby
[09:19:59] mlehrer: has joined #ruby
[09:20:09] klaas: has joined #ruby
[09:20:16] brodul_: has joined #ruby
[09:21:04] izaac: has joined #ruby
[09:21:25] yxhuvud: has joined #ruby
[09:21:26] iNs: has joined #ruby
[09:22:00] nicesignal: has joined #ruby
[09:22:23] nicoulaj: has joined #ruby
[09:22:46] bonhoeffer: has joined #ruby
[09:22:52] morfin: has joined #ruby
[09:23:01] Drakevr: has joined #ruby
[09:26:14] bonhoeffer: has joined #ruby
[09:26:22] claudiuinberlin: has joined #ruby
[09:29:47] bonhoeffer: has joined #ruby
[09:30:31] jottr: has joined #ruby
[09:31:01] Drakevr: has joined #ruby
[09:32:43] marr: has joined #ruby
[09:33:08] McSoFake: has joined #ruby
[09:33:15] bonhoeffer: has joined #ruby
[09:34:02] riotjones: has joined #ruby
[09:36:46] bonhoeffer: has joined #ruby
[09:38:08] cdg: has joined #ruby
[09:40:19] bonhoeffer: has joined #ruby
[09:43:49] bonhoeffer: has joined #ruby
[09:45:34] guille-moe: has joined #ruby
[09:47:24] bonhoeffer: has joined #ruby
[09:51:03] bonhoeffer: has joined #ruby
[09:54:32] bonhoeffer: has joined #ruby
[09:57:57] bonhoeffer: has joined #ruby
[09:58:33] cthulchu_: has joined #ruby
[09:58:35] Beams: has joined #ruby
[10:00:00] claudiuinberlin: has joined #ruby
[10:01:22] bonhoeffer: has joined #ruby
[10:05:04] sjums: has joined #ruby
[10:06:25] bonhoeffer: has joined #ruby
[10:07:04] sidx64: has joined #ruby
[10:07:14] akm980: has joined #ruby
[10:09:58] bonhoeffer: has joined #ruby
[10:11:42] Beams_: has joined #ruby
[10:12:51] goatish: has joined #ruby
[10:13:27] bonhoeffer: has joined #ruby
[10:13:51] sjums: has joined #ruby
[10:16:56] bonhoeffer: has joined #ruby
[10:20:30] bonhoeffer: has joined #ruby
[10:23:46] tomphp: has joined #ruby
[10:24:11] bonhoeffer: has joined #ruby
[10:27:44] bonhoeffer: has joined #ruby
[10:29:15] phaul: has joined #ruby
[10:30:59] bigblind: has joined #ruby
[10:31:02] bonhoeffer: has joined #ruby
[10:32:16] leitz: has joined #ruby
[10:33:30] jaruga: has joined #ruby
[10:34:30] jaruga: has left #ruby: ()
[10:34:32] bonhoeffer: has joined #ruby
[10:35:51] hahuang61: has joined #ruby
[10:36:12] marius: has joined #ruby
[10:36:44] soniya29: has joined #ruby
[10:37:10] leitz: I feel like a pariah; getting stuff done with Ruby and barely using objects I create.
[10:37:56] adlerdias: has joined #ruby
[10:38:14] bonhoeffer: has joined #ruby
[10:39:37] marius: has joined #ruby
[10:39:53] faces: has joined #ruby
[10:40:09] InfinityFye: has joined #ruby
[10:41:38] bonhoeffer: has joined #ruby
[10:45:05] bonhoeffer: has joined #ruby
[10:46:17] marius: has joined #ruby
[10:48:48] bonhoeffer: has joined #ruby
[10:49:36] mtkd: has joined #ruby
[10:51:37] marius: has joined #ruby
[10:52:06] bonhoeffer: has joined #ruby
[10:53:25] sameerynho: has joined #ruby
[10:54:59] conta: has joined #ruby
[10:55:38] bonhoeffer: has joined #ruby
[10:58:36] xfbs: has joined #ruby
[10:59:17] bonhoeffer: has joined #ruby
[10:59:31] schneider: has joined #ruby
[11:02:41] bonhoeffer: has joined #ruby
[11:02:53] sidx64: has joined #ruby
[11:03:38] InfinityFye: has left #ruby: ("Leaving")
[11:04:41] bigblind: has joined #ruby
[11:04:49] tbuehlmann: so, what's a nice way to programmatically call `foo.or(bar).or(baz)` for a an array `conditions = [foo, bar, baz]`?
[11:05:37] tomphp: has joined #ruby
[11:05:43] Ryzokuken: has joined #ruby
[11:05:44] InfinityFye: has joined #ruby
[11:05:55] InfinityFye: has left #ruby: ()
[11:06:11] bonhoeffer: has joined #ruby
[11:06:21] tomphp: has joined #ruby
[11:06:37] darix: tbuehlmann: hm?
[11:07:14] tomphp: has joined #ruby
[11:09:37] tomphp: has joined #ruby
[11:09:57] bonhoeffer: has joined #ruby
[11:10:51] phaul: tbuehlmann: can you inject &:or on the array? Depends on what you need...
[11:11:27] tbuehlmann: I'd like to do that, but what'd be your initial object?
[11:11:39] claudiuinberlin: has joined #ruby
[11:11:48] tobiasvl: yeah, it would be [foo, bar, baz].reduce(&:or)
[11:12:00] phaul: you dont need one with inject, either you start with initial object or not
[11:12:17] phaul: >> [].inject(0, :+)
[11:12:19] ruby[bot]: phaul: # => 0 (https://eval.in/966658)
[11:12:31] phaul: >> [].inject(false, &:or)
[11:12:32] ruby[bot]: phaul: # => false (https://eval.in/966659)
[11:12:47] tbuehlmann: the first element will be the initial object, AFAIR
[11:13:18] bonhoeffer: has joined #ruby
[11:13:40] phaul: I mean if the array is empty you can default to false or something, as in my examle
[11:13:52] phaul: but it depends n your needs.
[11:14:51] marius: has joined #ruby
[11:16:33] sjums: has joined #ruby
[11:16:44] bonhoeffer: has joined #ruby
[11:18:25] tbuehlmann: ah, I misread the documentation!
[11:18:48] sjums: has joined #ruby
[11:19:25] cschneid: has joined #ruby
[11:19:31] tbuehlmann: I thought when omitting the initial object the first element is going to be the memo object, effectively calling foo.or(foo).or(bar).or(baz), but it really will be foo.or(bar).or(baz). thanks a lot
[11:19:46] jrabe: has joined #ruby
[11:20:15] bonhoeffer: has joined #ruby
[11:21:35] dminuoso: 12:11 tobiasvl | yeah, it would be [foo, bar, baz].reduce(&:or)
[11:21:39] dminuoso: Is the way to do it.
[11:21:56] dminuoso: tbuehlmann: btw, want a cool notion of inject/reduce?
[11:22:32] dminuoso: tbuehlmann: https://wiki.haskell.org/wikiupload/3/3e/Right-fold-transformation.png in ruby this would be: obj.reduce(z, &f)
[11:23:16] dminuoso: Though sadly inject behaves as a left fold, so https://wiki.haskell.org/wikiupload/5/5a/Left-fold-transformation.png
[11:23:59] bonhoeffer: has joined #ruby
[11:24:03] tbuehlmann: now tell me which one is slighty faster, [foo, bar, baz].reduce(&:or) or [foo, bar, baz].reduce(:or) :P
[11:24:15] dminuoso: asm>> [foo, bar, baz].reduce(&:or)
[11:24:17] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966671
[11:24:17] yonahw: has joined #ruby
[11:24:20] dminuoso: asm>> [foo, bar, baz].reduce(:or)
[11:24:21] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966672
[11:24:30] RougeR: has joined #ruby
[11:24:30] RougeR: has joined #ruby
[11:25:07] dminuoso: tbuehlmann: Intuition says &:or
[11:25:16] Ryzokuken: has joined #ruby
[11:25:59] dminuoso: tbuehlmann: this picture makes it much easier to properly utilize reduce/inject, because you can think of it as a structural transformation from a list into a calculation.
[11:26:20] Cavallari: has joined #ruby
[11:26:38] jrabe: Are there any known differences in the behavior of Kernel#trap on Linux vs. FreeBSD when multiple threads are active?
[11:27:29] dminuoso: if you had some `app = -> a, b { a << b }`, then list.inject([], &add) is a noop
[11:27:44] dminuoso: which is really cool to look at
[11:27:46] bonhoeffer: has joined #ruby
[11:28:08] Psybur: has joined #ruby
[11:28:27] marius: has joined #ruby
[11:29:06] dminuoso: so you can reverse a list like this
[11:29:08] dminuoso: >> prep = -> a, b { p a; a.prepend b }; [1,2,3].inject([], &prep)
[11:29:10] ruby[bot]: dminuoso: # => [] ...check link for more (https://eval.in/966674)
[11:29:19] dminuoso: >> prep = -> a, b { a.prepend b }; [1,2,3].inject([], &prep)
[11:29:20] ruby[bot]: dminuoso: # => undefined method `prepend' for []:Array (NoMethodError) ...check link for more (https://eval.in/966675)
[11:29:26] dminuoso: >> prep = -> a, b { a.unshift b }; [1,2,3].inject([], &prep)
[11:29:27] ruby[bot]: dminuoso: # => [3, 2, 1] (https://eval.in/966676)
[11:29:28] nowhere_man: has joined #ruby
[11:29:43] dminuoso: the less you think in terms of "memo", the healthier your code becomes
[11:29:48] Terens: has joined #ruby
[11:29:55] Terens: I hate rescue nil
[11:30:00] bigblind: has joined #ruby
[11:31:24] bonhoeffer: has joined #ruby
[11:32:18] marius: has joined #ruby
[11:34:53] phaul: has joined #ruby
[11:35:00] bonhoeffer: has joined #ruby
[11:35:04] fribmendes: has joined #ruby
[11:35:39] _aeris: has joined #ruby
[11:36:03] fribmendes: has joined #ruby
[11:38:21] bonhoeffer: has joined #ruby
[11:40:35] AJA4350: has joined #ruby
[11:40:35] soniya29: has joined #ruby
[11:40:37] soniya29_: has joined #ruby
[11:41:13] ldnunes: has joined #ruby
[11:41:50] bonhoeffer: has joined #ruby
[11:41:51] jamesaxl: has joined #ruby
[11:41:57] sjums: has joined #ruby
[11:43:03] hahuang61: has joined #ruby
[11:43:26] Cavallari: has joined #ruby
[11:44:46] shinnya: has joined #ruby
[11:45:01] marius: has joined #ruby
[11:45:05] DTZUZO: has joined #ruby
[11:45:21] bonhoeffer: has joined #ruby
[11:46:47] burgestrand: has joined #ruby
[11:49:01] bonhoeffer: has joined #ruby
[11:49:14] Florent974: has joined #ruby
[11:49:50] Fusselgesicht: has joined #ruby
[11:50:12] Florent974: I have 2 dates, one is : today = Time.now.strftime("%d-%m-%Y) and bd = "01-12-1980"
[11:50:24] Florent974: I wish to be able to show age
[11:50:28] Florent974: anyone can help me ?
[11:52:26] bonhoeffer: has joined #ruby
[11:53:31] jrabe: Florent974, require 'date'; ((Date.today - Date.parse('1980-12-01')) / 365.25).floor.to_s + " years"
[11:53:55] jrabe: you can subtraact dates using the minus operator, but don't call strftime first
[11:55:57] bonhoeffer: has joined #ruby
[11:56:02] Florent974: jrabe, thank you very much!
[11:58:40] cadillac_: has joined #ruby
[11:59:06] al2o3-cr: i quite like this one; (Time.now - Time.utc(1980, 12, 1).to_i).year - 1970
[11:59:28] bonhoeffer: has joined #ruby
[12:00:24] sidx64: has joined #ruby
[12:00:30] Florent974: al2o3-cr, not a problem if i'm located in gmt+4 ?
[12:01:11] al2o3-cr: give an hour or two ;P
[12:01:32] Florent974: al2o3-cr, thanks!
[12:03:02] bonhoeffer: has joined #ruby
[12:04:43] tomphp: has joined #ruby
[12:06:27] bonhoeffer: has joined #ruby
[12:06:32] jrabe: ah, the #year is nice
[12:06:35] LightStalker: has joined #ruby
[12:06:44] zanoni: has joined #ruby
[12:10:03] bonhoeffer: has joined #ruby
[12:10:15] bigblind: has joined #ruby
[12:12:55] Serpent7776: has joined #ruby
[12:14:11] bonhoeffer: has joined #ruby
[12:14:17] claudiuinberlin: has joined #ruby
[12:14:24] Azure: has joined #ruby
[12:14:41] claudiuinberlin: has joined #ruby
[12:15:49] zapata: has joined #ruby
[12:17:26] SteenJobs: has joined #ruby
[12:17:43] bonhoeffer: has joined #ruby
[12:18:08] John_Ivan: has joined #ruby
[12:18:08] John_Ivan: has joined #ruby
[12:29:16] psychicist__: has joined #ruby
[12:29:34] tomphp: has joined #ruby
[12:30:05] riotjoe: has joined #ruby
[12:31:12] tomphp: has joined #ruby
[12:33:54] jrabe: Is there a clean way to prevent a thread (in this case a thin web server) from trapping signals? Ideally without patching Kernel#trap?
[12:35:15] Zaab1t: has joined #ruby
[12:36:10] mtkd: has joined #ruby
[12:36:23] TomyWork: i want to store times in a json. is there some canonical format that i can use that ruby will accept, regardless of locale, OS and such?
[12:36:41] TomyWork: date+time, that is
[12:37:09] TomyWork: 2018-03-05 12:37:12 GMT or something
[12:37:29] guille-moe: has joined #ruby
[12:40:40] tomphp: has joined #ruby
[12:40:41] schneider: has joined #ruby
[12:40:54] hahuang61: has joined #ruby
[12:41:57] canton7: TomyWork, iso8601?
[12:42:12] canton7: that's the bog-standard date/time serialization format. It's standard to use it in json as well
[12:42:15] fribmendes: has joined #ruby
[12:43:50] burgestrand: has joined #ruby
[12:46:18] TomyWork: ok, but it's a configuration json
[12:46:23] TomyWork: json5 actually
[12:46:46] TomyWork: (cause i was annoyed with the lack of trailing commas and comments ^^)
[12:48:45] schneider: has joined #ruby
[12:50:47] karapetyan: has joined #ruby
[12:52:47] vondruch: has joined #ruby
[12:57:13] dminuoso: >> [1,2,3,4,5].inject([]) { |l, r| [1, l] }
[12:57:14] ruby[bot]: dminuoso: # => [1, [1, [1, [1, [1, []]]]]] (https://eval.in/966708)
[13:01:13] ltem: has joined #ruby
[13:03:45] synthroid: has joined #ruby
[13:04:21] tomphp: has joined #ruby
[13:04:46] conta: has joined #ruby
[13:06:33] ldnunes: has joined #ruby
[13:08:10] dminuoso: Let's play a game. Who here can give me a gist, listing the exact semantics of the keyword "next" ?
[13:08:20] fribmendes: has joined #ruby
[13:08:22] _aeris_: has joined #ruby
[13:08:30] RougeR: has joined #ruby
[13:08:39] Flonk: has joined #ruby
[13:09:59] tcopeland: has joined #ruby
[13:12:04] tvw: has joined #ruby
[13:15:00] hahuang61: has joined #ruby
[13:15:48] Ryzokuken: has joined #ruby
[13:16:43] karapetyan: has joined #ruby
[13:18:27] burgestrand: has joined #ruby
[13:21:19] TomyWork: isnt there a spec?
[13:25:37] karapetyan: has joined #ruby
[13:28:13] ltem: has joined #ruby
[13:28:30] bigblind: has joined #ruby
[13:32:00] dminuoso: TomyWork: Hah. There's an ISO standard that no longer is relevant. But the point is just whether regular ruby users understand their language well enough.
[13:32:05] schneider-: has joined #ruby
[13:33:59] drewmcmillan: has joined #ruby
[13:36:05] TomyWork: well, i have yet to use it in non-trivial circumstances ^^
[13:36:45] fribmendes: has joined #ruby
[13:37:07] memo1: has joined #ruby
[13:37:17] TomyWork: HNNNNNG, why does Time.new accept strings as its first parameter
[13:37:47] TomyWork: took me way too long to figure out why it's cutting off everything but the year
[13:39:09] luminous: has joined #ruby
[13:39:57] dminuoso: TomyWork: So what do you think "next" does?
[13:40:45] luminous: has joined #ruby
[13:41:19] luminous: has joined #ruby
[13:41:20] luminous: has joined #ruby
[13:41:24] TomyWork: dminuoso returns a value from a block to the caller, instructing it to go to the next item
[13:41:48] TomyWork: i'm pretty sure there's more involved behind the scenes, but that's how i use it
[13:43:58] karapetyan: has joined #ruby
[13:45:33] luminous: has joined #ruby
[13:49:54] tubbo: has joined #ruby
[13:50:14] mcr1: has joined #ruby
[13:50:44] dminuoso: TomyWork: Alright! So how is `next` different from `return` ?
[13:50:50] karapetyan: has joined #ruby
[13:51:05] dminuoso: TomyWork: And furthermore, you dont always use `next` from inside a block.
[13:51:10] dminuoso: For loops for example.
[13:51:28] TomyWork: tbh i have no idea what exactly happens if you return from a block
[13:51:35] TomyWork: i'd rather just not do it
[13:51:43] dminuoso: asm>> for i in (1..3); puts 1; end
[13:51:43] TomyWork: seems unclean, if it works
[13:51:44] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966751
[13:51:58] dminuoso: Or well, I guess it formally creates a block. TIL.
[13:52:03] dminuoso: TomyWork: It absolutely works.
[13:52:09] dminuoso: Just begs the question what it does.
[13:52:13] dminuoso: TomyWork: And then there's break.
[13:52:31] dminuoso: So now you have `break`, `next`, `return`. All three are effectively non local gotos.
[13:52:41] joe_from_maine: has joined #ruby
[13:52:55] TomyWork: and i'd rather avoid non-local gotos :)
[13:53:06] dminuoso: TomyWork: they are the essence of imperative programming
[13:53:11] TomyWork: err, how is next non-local?
[13:53:58] dminuoso: asm>> proc{ next }
[13:53:59] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966758
[13:54:01] TomyWork: the thing is, return crosses scopes
[13:54:12] cdg: has joined #ruby
[13:54:16] TomyWork: what happens if your block is run on another thread?
[13:54:19] dminuoso: TomyWork: ^- see the disassmbled bytecode? See that "jump" instruction?
[13:54:32] dminuoso: Oh I guess next is a local goto _here_
[13:54:35] dminuoso: but how about
[13:54:44] dminuoso: asm>> p { next }
[13:54:45] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966759
[13:54:46] TomyWork: does the original function still return?
[13:54:57] dminuoso: Oh well! Next is a local goto indeed.
[13:55:04] dminuoso: asm>> p { break }
[13:55:05] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966760
[13:55:09] dminuoso: There we go!
[13:55:19] dminuoso: break was the non local goto.
[13:55:46] TomyWork: yeah i figured break was something like a throw
[13:55:52] dminuoso: TomyWork: and return is a throw too.
[13:55:58] TomyWork: that's how i implemented it in my expression parser ^^
[13:56:05] dminuoso: asm>> proc{ return 10 }
[13:56:06] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966761
[13:56:19] dminuoso: TomyWork: So the reason both are non local, is that they jump into preset catch tables.
[13:56:22] TomyWork: https://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax <-- that one
[13:56:48] dminuoso: TomyWork: you can observe this from the fact that if you return from a _proc_, it doesn't straight up transfer control to the caller of the proc, but into.. well this is where things get really messy.
[13:57:07] TomyWork: and that is why i avoid it :)
[13:57:28] TomyWork: one does not simply walk out of a procedure from a block
[13:57:38] TomyWork: s/procedure/function/
[13:58:16] dminuoso: TomyWork: This is a _crude_, incompletely and partially incorrect list: https://gist.github.com/dminuoso/fba06a2323bbedf946ef144eb4f500f2
[13:58:30] dminuoso: (the reason is that its incorrect is that the semantics of `return` are far more bizarre)
[13:58:55] TomyWork: funny how return has the simplest description
[13:58:56] dminuoso: I think out of all, "next" is best described with "transfer control to end of current block"
[13:59:00] TomyWork: yet is the biggest mindfuck
[13:59:04] dminuoso: TomyWork: It doesn't. It's wrong.
[13:59:51] cdg: has joined #ruby
[14:00:18] TomyWork: line 10 is wrong too
[14:00:26] TomyWork: you discount the condition
[14:00:39] dminuoso: TomyWork: well I now know how to phrase next correctly
[14:00:44] dminuoso: the correct form is very simple
[14:00:59] dminuoso: "transfer control to end of current block"
[14:01:05] dminuoso: + stack maintainance
[14:01:30] dminuoso: asm>> loop { next}
[14:01:31] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966771
[14:01:41] dminuoso: asm>> loop { next 10; }
[14:01:46] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/966773
[14:02:04] dminuoso: so "push on stack, transfer control"
[14:02:31] _aeris_: has joined #ruby
[14:02:35] TomyWork: what stack maintenance is there to do?
[14:02:41] TomyWork: oh right, dynamic language
[14:02:51] TomyWork: discarding locals
[14:02:51] dminuoso: no it just pushes the argument on the current stack thats all
[14:03:04] dminuoso: so that it becomes the return value of the block
[14:03:14] fribmendes: has joined #ruby
[14:05:39] dminuoso: TomyWork: So how about this
[14:05:51] ananth99: has joined #ruby
[14:05:51] dminuoso: TomyWork: without running this, tell me how this would behave
[14:05:54] synthroid: has joined #ruby
[14:06:08] dminuoso: def m(); yield; end; m &proc{ break }
[14:07:39] dminuoso: TomyWork: The basic notion is, that during compilation the catch table has to be known.
[14:07:47] dminuoso: But from that scope there exists no catch table
[14:08:15] dminuoso: It doesnt fit completely tohugh
[14:08:25] dminuoso: >> def q; yield; end; def m; while true; q &proc{ break }; end; end; m
[14:08:26] ruby[bot]: dminuoso: # => break from proc-closure (LocalJumpError) ...check link for more (https://eval.in/966775)
[14:08:41] TomyWork: "def m(); yield; end" is equivalent to "def m(&block); block.call; end", right?
[14:08:44] dminuoso: >> >() { proc{ break }.() }.()
[14:08:45] ruby[bot]: dminuoso: # => /tmp/execpad-03c2d6e47620/source-03c2d6e47620:2: syntax error, unexpected '>' ...check link for more (https://eval.in/966776)
[14:08:50] dminuoso: >> ->() { proc{ break }.() }.()
[14:08:51] ruby[bot]: dminuoso: # => break from proc-closure (LocalJumpError) ...check link for more (https://eval.in/966777)
[14:09:25] dminuoso: TomyWork: Usually yes.
[14:09:34] TomyWork: dminuoso you got a slight lisp there
[14:09:43] dminuoso: >> ->() { proc{ break }[] }[]
[14:09:44] ruby[bot]: dminuoso: # => break from proc-closure (LocalJumpError) ...check link for more (https://eval.in/966779)
[14:09:45] dminuoso: if you prefer
[14:10:02] dminuoso: >> def m; break; end
[14:10:04] ruby[bot]: dminuoso: # => /tmp/execpad-9136ce6ca1f1/source-9136ce6ca1f1: /tmp/execpad-9136ce6ca1f1/source-9136ce6ca1f1:2: Inva ...check link for more (https://eval.in/966780)
[14:10:09] dminuoso: >> define_method(:m, &proc{ break }); m
[14:10:10] ruby[bot]: dminuoso: # => nil (https://eval.in/966781)
[14:10:22] luminous: has joined #ruby
[14:10:33] ananth99: Hello all, came across a peculiar issue where a valid photo url(http://s3-us-west-2.amazonaws.com/images.verifymybiz.com/location_photos/photos/000/085/493/original/preci.jpg.jpg?1515869697) when downloaded to my computer gets recognised as a damaged file. I used the following function to download the image.
[14:10:34] ananth99: file_name = SecureRandom.uuid.split('-').join[0..45].to_s + '.png'
[14:10:34] ananth99: file_path = "/tmp/location_photos/#{file_name}"
[14:10:34] ananth99: file = open(file_path, "wb")
[14:10:34] ananth99: file.write(open("http://s3-us-west-2.amazonaws.com/images.verifymybiz.com/location_photos/photos/000/085/493/original/preci.jpg.jpg?1515869697", :allow_redirections => :safe).read)
[14:10:35] ananth99: I have no idea as to why the image seems to be damaged after it's downloaded. Any pointers on this would be really helpful! TIA
[14:10:37] dminuoso: >> proc{ break }[]
[14:10:51] dminuoso: TomyWork: No matter how hard I try, I cant find any satisfactory explanation for all of this.
[14:10:59] TomyWork: ananth99 next time, please pastebin your code
[14:11:06] dminuoso: Apart from "Lots of if/else" spaghetti in the YARV compiler.
[14:11:14] TomyWork: especially if you markdown it ^^
[14:12:02] ananth99: TomyWork Duly noted. :)
[14:12:03] TomyWork: ananth99 what happens if you curl/wget the file
[14:12:20] zanoni: has left #ruby: ()
[14:12:29] dminuoso: arahael: What is your `open` here?
[14:12:33] dminuoso: Is that supposed to be Kernel#open?
[14:12:50] ananth99: TomyWork I tried saving the file from chrome as well. Same issue persists.
[14:13:03] TomyWork: ananth99 so it's not a ruby problem?
[14:13:47] ananth99: open is from OpenURI
[14:14:27] jcalla: has joined #ruby
[14:14:43] ananth99: TomyWork trying to figure that out. I mean can this issue be fixed by fetching the photo in a different way?
[14:14:57] ananth99: I'll try cURL and post here
[14:15:04] burgestrand: ananth99 Your image is a WebP, not jpg
[14:15:59] dminuoso: Burgestrand: You! You're the guilty one.
[14:16:12] dminuoso: You are the reason my simple view on return/break/next is kaputt.
[14:16:27] dminuoso: You broke it without repairing it.
[14:16:39] burgestrand: ananth99 If you open your URL in e.g. Safari you'll also see a broken image, because Safari no like webp
[14:16:41] ananth99: How did you figure out that it was a WebP
[14:17:00] Mon_Ouie: What did your vision expect Thread.new { break 5 } to do?
[14:17:24] burgestrand: ananth99 I downloaded it and ran `file` on it: data: RIFF (little-endian) data, Web/P image, VP8 encoding, 1900x919, Scaling: [none]x[none], YUV color, decoders should clamp
[14:18:07] ldepandis: has joined #ruby
[14:18:15] burgestrand: Mon_Ouie it's nice to see an old familiar name in here, I'm glad you're still around :)
[14:18:23] Mon_Ouie: Nice to see you too :)
[14:19:38] alex``: has joined #ruby
[14:20:08] Papierkorb: has joined #ruby
[14:21:19] n0m4d1c: has joined #ruby
[14:21:26] schneider-: has joined #ruby
[14:21:43] Papierkorb: has left #ruby: ("Konversation terminated!")
[14:29:31] karapetyan: has joined #ruby
[14:29:34] ananth99: Burgestrand thanks for the tip. :)
[14:30:48] burgestrand: ananth99 yw :) managed to fix it?
[14:31:40] ananth99: Burgestrand: Yes. We just went around using the "identify" cmd that imagemagick provides. Didn't know "file" cmd could do it. Very sweet ~!
[14:31:54] bmurt: has joined #ruby
[14:32:29] riotjones: has joined #ruby
[14:32:58] LightStalker: has joined #ruby
[14:33:32] John_Ivan: has joined #ruby
[14:33:32] John_Ivan: has joined #ruby
[14:34:02] burgestrand: ananth99 Nice :)
[14:34:58] Cthulu201: has joined #ruby
[14:35:27] tubbo: has joined #ruby
[14:36:26] k0mpa: has joined #ruby
[14:37:08] gheegh: has joined #ruby
[14:37:27] hahuang61: has joined #ruby
[14:39:48] DLSteve: has joined #ruby
[14:40:57] mtkd: has joined #ruby
[14:46:15] griffindy: has joined #ruby
[14:48:05] karapetyan: has joined #ruby
[14:54:26] nickjj_: has joined #ruby
[14:54:32] jottr_: has joined #ruby
[14:54:38] synthroid: has joined #ruby
[14:55:03] mozzarel1: has joined #ruby
[14:55:15] hr3f: has joined #ruby
[14:56:20] universal: has joined #ruby
[14:56:23] eb0t: has joined #ruby
[14:56:31] craysiii1: has joined #ruby
[14:56:38] eblip: has joined #ruby
[14:56:56] kspencer-: has joined #ruby
[14:56:58] brodul_: has joined #ruby
[14:57:00] mbrgm: has joined #ruby
[14:57:06] Phate: has joined #ruby
[14:57:24] McSoFake_: has joined #ruby
[14:57:37] Papierko-: has joined #ruby
[14:57:41] mniip: has joined #ruby
[14:57:43] balo: has joined #ruby
[14:58:08] byte512: has joined #ruby
[14:58:08] n13z: has joined #ruby
[14:58:39] c0ncealed: has joined #ruby
[14:58:59] nicoulaj: has joined #ruby
[14:59:17] saksida: has joined #ruby
[15:00:32] n0m4d1c: has joined #ruby
[15:00:45] karapetyan: has joined #ruby
[15:00:54] nowhere_man: has joined #ruby
[15:01:14] Mia: has joined #ruby
[15:01:14] Mia: has joined #ruby
[15:02:22] oleo: has joined #ruby
[15:02:37] psmolen: has joined #ruby
[15:02:58] iNs: has joined #ruby
[15:03:20] karapetyan: has joined #ruby
[15:05:43] karapetyan: has joined #ruby
[15:06:07] synthroid: has joined #ruby
[15:07:21] guille-moe: has joined #ruby
[15:07:42] kapil___: has joined #ruby
[15:08:57] fribmendes: has joined #ruby
[15:09:36] karapetyan: has joined #ruby
[15:10:38] nowhereman_: has joined #ruby
[15:14:00] Rapture: has joined #ruby
[15:14:38] karapetyan: has joined #ruby
[15:15:20] haxx0r: has joined #ruby
[15:15:41] haxx0r: can i post rails related question?
[15:16:10] dminuoso: ?rails haxx0r
[15:16:10] ruby[bot]: haxx0r: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[15:16:15] kspencer: why not use #rubyonrails
[15:16:31] sagax: has joined #ruby
[15:16:42] haxx0r: has left #ruby: ()
[15:21:01] aScottishBoat: has joined #ruby
[15:22:14] pastorinni: has joined #ruby
[15:22:30] tubbo: has joined #ruby
[15:23:59] nowhereman_: has joined #ruby
[15:25:27] milardovich: has joined #ruby
[15:26:34] bonhoeffer: has joined #ruby
[15:28:42] tubbo: has joined #ruby
[15:29:20] DTZUZO: has joined #ruby
[15:29:20] netherwolfe: has joined #ruby
[15:29:59] cschneid: has joined #ruby
[15:31:20] joast: has joined #ruby
[15:31:25] nielsk: has joined #ruby
[15:31:57] nielsk: has joined #ruby
[15:32:45] nielsk: has joined #ruby
[15:32:54] ldnunes: has joined #ruby
[15:34:01] momomo: has joined #ruby
[15:34:06] momomo: is there a deep_merge that actuall works ?
[15:34:54] Mon_Ouie: !kick momomo
[15:34:54] ruby[bot]: +bbb $a:momomo$#ruby-banned momomo!*@*$#ruby-banned *!*@194.103.63.165$#ruby-banned
[15:34:55] ruby[bot]: ruby[bot] kicked momomo: offense, see http://ruby-community.com/pages/user_rules
[15:35:47] darix: Mon_Ouie: now i dont get the value for the password!
[15:35:49] darix: you meanie
[15:36:12] ruby[bot]: -bbb $a:momomo$#ruby-banned momomo!*@*$#ruby-banned *!*@194.103.63.165$#ruby-banned
[15:37:39] karapetyan: has joined #ruby
[15:41:02] momomo: has joined #ruby
[15:41:11] momomo: i am back
[15:41:54] momomo: we are using middleman... if i want to add a function to Hash .. where do I do that ?
[15:41:56] Mon_Ouie: momomo: Please use gist to share code, don't copy paste it on the channel
[15:42:19] momomo: Mon_Ouie: Ok, but the channel is dead ... we shouldnt be so sensitive
[15:42:56] momomo: where would this method be added? https://stackoverflow.com/a/5581667
[15:43:09] momomo: So that it works on a hash directly
[15:43:19] hahuang61: has joined #ruby
[15:43:24] momomo: "monkey-patching" ?
[15:43:43] Mon_Ouie: monkey patching just means adding methods to a class you didn't create
[15:43:59] Mon_Ouie: Which is what the second snippet of that answer does
[15:45:04] momomo: But where do i add that code? How do I get ruby to read it in?
[15:45:27] momomo: We are using middleman ... i have some files .. general_helpers.rb and a few otherws
[15:45:45] momomo: Mon_Ouie:
[15:46:10] momomo: Tried to copy and paste it into general_helpers .. and a own file Hash.rb but to no avail
[15:46:46] nielsk: has joined #ruby
[15:47:04] Mon_Ouie: You put it in a ruby file that you execute or require from some other file
[15:47:14] Mon_Ouie: It's just a regular piece of code
[15:49:00] nielsk: has joined #ruby
[15:49:34] jottr_: has joined #ruby
[15:52:41] desperek: has joined #ruby
[15:53:22] troys: has joined #ruby
[16:00:32] zautomata: has joined #ruby
[16:00:38] zautomata: has joined #ruby
[16:00:42] chouhoulis: has joined #ruby
[16:00:59] momomo: is there a way to protoype a method into a class in ruby ?
[16:01:14] bougyman: modules are used for that.
[16:01:31] bougyman: well, closest thing to prototyping a method that ruby has.
[16:02:07] al2o3-cr: what about refinements
[16:02:58] schneider-: has joined #ruby
[16:03:15] SeepingN: has joined #ruby
[16:04:08] momomo: bougyman: any example ?
[16:04:15] momomo: just add a random method to Hash ?
[16:04:50] momomo: bougyman: ive tried https://hastebin.com/uyahisetax.rb
[16:05:03] momomo: but I am getting a startup error saying the method include is private
[16:05:22] suhdood: has joined #ruby
[16:06:03] momomo: config.rb:210:in `initialize': private method `include' called for GeneralHelpers::Hash:Class (NoMethodError)
[16:10:11] _aeris_: has joined #ruby
[16:10:36] aguestuser: has joined #ruby
[16:10:54] inerthia: has joined #ruby
[16:10:54] inerthia: has joined #ruby
[16:11:04] Mon_Ouie: Use `class Hash; include CoreExtensions::Hash; end' (include is private so it cannot be called with an explicit receiver)
[16:12:18] schneider-: has joined #ruby
[16:13:26] momomo: Mon_Ouie: I am guessing that would be the same as just copy and paste that method into the class here ... i get no error but the method is still not available on other {} objects
[16:13:53] momomo: doing just class Hash; def recursive_merge() ... ; is not enough
[16:14:59] momomo: right after, config.rb:212:in `initialize': undefined method `merge_recursive' for {}:Hash (NoMethodError)
[16:15:24] momomo: Can you make this work?
[16:15:24] momomo: https://hastebin.com/izocekuwut.rb
[16:15:28] Mon_Ouie: When do you load the file in which you defined merge_recursive?
[16:15:59] Mon_Ouie: Also you recursive_merge != merge_recursive
[16:16:07] jnollette: has joined #ruby
[16:16:40] momomo: The hastebin are all in the same file .. pasted in a config.rb which seems to run when I start middleman ..
[16:17:32] Mon_Ouie: The file you pasted runs just fine in Ruby
[16:17:59] amatas: has joined #ruby
[16:18:32] momomo: Does it matter if it is part of another file ... or does it have to be in a file of its own ?
[16:19:03] vutral|kali: has joined #ruby
[16:19:03] vutral|kali: has joined #ruby
[16:19:42] adlerdias: has joined #ruby
[16:19:55] Mon_Ouie: It doesn't. One thing that may matter is if Hash does not refer to ::Hash but some other Hash class defined in a module. Does using 'class ::Hash' behave the same way?
[16:20:58] clemens3: has joined #ruby
[16:23:02] amatas: has joined #ruby
[16:23:14] StarSeed0000: has joined #ruby
[16:24:12] adlerdias: has joined #ruby
[16:30:04] memo1: has joined #ruby
[16:31:41] cdg: has joined #ruby
[16:36:07] netherwolfe_: has joined #ruby
[16:36:34] jnollette: has joined #ruby
[16:37:26] synthroid: has joined #ruby
[16:38:14] amelliaa: has joined #ruby
[16:38:23] dviola: has joined #ruby
[16:38:57] hahuang61: has joined #ruby
[16:39:20] heftig: has joined #ruby
[16:40:48] apeiros: has joined #ruby
[16:43:19] heftig: has joined #ruby
[16:45:58] mtkd: has joined #ruby
[16:49:26] cadillac_: has joined #ruby
[16:50:41] vutral|kali: has joined #ruby
[16:50:41] vutral|kali: has joined #ruby
[16:50:54] aScottishBoat: has joined #ruby
[16:51:44] shoogz: has joined #ruby
[16:52:14] shoogz: has joined #ruby
[16:52:44] momomo: is there a deepmerge that can merge and take a lambda ?
[16:52:46] shoogz: has joined #ruby
[16:52:50] Papierko-: has left #ruby: ("Konversation terminated!")
[16:53:59] apeiros: momomo: you can write one rather trivially
[16:54:19] apeiros: blocks can accept blocks ever since ruby 1.9 iirc
[16:54:33] momomo: apeiros: i am a stranger to ruby .. so difficult right now ... i found some incomplete examples .. here is one :
[16:54:34] roshanavand: has joined #ruby
[16:54:51] momomo: https://hastebin.com/epopohomil.rb
[16:55:10] anisha: has joined #ruby
[16:56:11] gheegh: has joined #ruby
[16:59:31] alex``: has joined #ruby
[17:00:13] apeiros: uh, ok, bye.
[17:00:48] momomo: has joined #ruby
[17:00:58] momomo: I was disconnected ... did I miss something?
[17:01:21] [Butch]: has joined #ruby
[17:01:28] apeiros: no. I was about to write something. also this channel is logged re "did I miss something"
[17:01:58] apeiros: I can help you write your own implementation if you want.
[17:04:09] cadillac_: has joined #ruby
[17:04:18] cthulchu: has joined #ruby
[17:05:12] talntid: has left #ruby: ()
[17:13:46] hahuang61: has joined #ruby
[17:16:49] schneider-: has joined #ruby
[17:19:30] karapetyan: has joined #ruby
[17:22:00] anjen: has joined #ruby
[17:22:44] d10n-work: has joined #ruby
[17:22:46] darkhanb: has joined #ruby
[17:23:05] shoogz: has joined #ruby
[17:23:15] samort7: has joined #ruby
[17:23:24] jcarl43: has joined #ruby
[17:23:36] shoogz: has joined #ruby
[17:23:43] n0m4d1c: has joined #ruby
[17:24:06] shoogz: has joined #ruby
[17:24:16] samort7: has joined #ruby
[17:24:38] shoogz: has joined #ruby
[17:25:09] shoogz: has joined #ruby
[17:25:14] samort7: has joined #ruby
[17:25:40] shoogz: has joined #ruby
[17:27:17] schneider-: has joined #ruby
[17:27:51] shoogz: has joined #ruby
[17:28:57] cadillac_: has joined #ruby
[17:31:50] shoogz: has joined #ruby
[17:32:56] shoogz: has joined #ruby
[17:32:57] cdg: has joined #ruby
[17:33:27] shoogz: has joined #ruby
[17:33:58] shoogz: has joined #ruby
[17:37:19] shoogz: has joined #ruby
[17:38:24] marr: has joined #ruby
[17:38:25] shoogz: has joined #ruby
[17:38:57] shoogz: has joined #ruby
[17:39:04] Cohedrin: has joined #ruby
[17:39:18] bigblind: has joined #ruby
[17:40:08] shoogz: has joined #ruby
[17:40:36] shoogz: has joined #ruby
[17:41:07] shoogz: has joined #ruby
[17:41:31] tomlukeywood: has joined #ruby
[17:42:47] shoogz: has joined #ruby
[17:43:18] rhebz916: has joined #ruby
[17:46:30] biberu: has joined #ruby
[17:46:38] warrshrike: has joined #ruby
[17:46:58] warrshrike: getting strange behaviour from my class
[17:47:29] warrshrike: class Users def initialize @users = [] end def insertUser u @users << u end end
[17:47:36] warrshrike: so this is the class
[17:48:00] warrshrike: bb = Users.new; bb.insertUser User.new 11, true
[17:48:03] warrshrike: this is the code
[17:48:18] warrshrike: `insertUser': undefined method `<<' for false:FalseClass (NoMethodError)
[17:48:25] warrshrike: this is the error^
[17:49:42] eckhardt: has joined #ruby
[17:50:06] tubbo: has joined #ruby
[17:50:48] gizmore: warrshrike: you are sending << to a boolean
[17:51:11] gizmore: No such method on that false boolean
[17:51:26] dmitriy_: has joined #ruby
[17:51:52] TheMoonMaster: warrshrike: also you probably want `insert_user`, not `insertUser`
[17:51:56] gheegh: has joined #ruby
[17:51:58] hahuang61: has joined #ruby
[17:52:01] apeiros: warrshrike: the code you provided does not actually raise the exception you say
[17:52:11] sanscoeur: has joined #ruby
[17:52:15] apeiros: please don't paste fake code. that makes it just harder for everybody.
[17:52:32] hahuang65: has joined #ruby
[17:52:44] sanscoeur: has joined #ruby
[17:53:28] warrshrike_: has joined #ruby
[17:53:28] apeiros: (and that's after fixing the obvious bugs like Users vs. User and missing newlines/;)
[17:53:43] warrshrike_: sorry i got dc'd
[17:53:54] warrshrike_: Im doing: @users << u
[17:53:57] apeiros: ?log warrshrike
[17:53:57] ruby[bot]: apeiros: I don't know anything about log
[17:54:01] warrshrike_: @users is an array
[17:54:01] apeiros: ?logs warrshrike
[17:54:01] ruby[bot]: warrshrike: You can find a log of this channel at https://irclog.whitequark.org/ruby/
[17:54:23] warrshrike_: thanks! but it isnt boolean right?
[17:54:46] schneider-: has joined #ruby
[17:54:52] apeiros: not in the code you provided. but since that's not the real code, what's the point?
[17:55:48] warrshrike_: okay here is the complete code...
[17:55:48] warrshrike_: https://gist.github.com/anonymous/c5763312c69c8d3a5ae2ab7be9e16b20
[17:56:20] warrshrike_: TheMoonMaster: anything wrong with camel casing? :/
[17:56:23] apeiros: progress. now the full exception.
[17:56:39] warrshrike_: RubymineProjects/HelperBot/user.rb:29:in `insertUser': undefined method `<<' for false:FalseClass (NoMethodError) from /mnt/c/Users/ali_a/RubymineProjects/HelperBot/user.rb:72:in `<top (required)>' from -e:1:in `load' from -e:1:in `<main>'
[17:57:57] apeiros: warrshrike_: you probably should take a look at that yaml file
[17:58:10] mcr1: has joined #ruby
[17:58:13] apeiros: so yes, @users is a boolean. real code matters.
[17:58:21] orbyt_: has joined #ruby
[17:58:22] warrshrike_: there is no yml file...yet
[17:58:55] apeiros: also think about `bb.insertUser User.new 11, true`
[17:59:12] apeiros: is true an argument for insertUser or for new? why? and how should ruby decide?
[17:59:36] warrshrike_: okay yeah i need parenthesis
[17:59:54] warrshrike_: imo. ruby stresses a lot on no parens so its easy to go overboard
[18:01:12] daveomcd: has joined #ruby
[18:01:48] warrshrike_: also ruby's runtime errors can be a ticking time bomb for some like me who is unable to do TDD
[18:02:55] daveomcd: I'm getting the following error, I use rvm but from what I can tell my certs are up to date... anyone know some commands that I could use to verify that and even correct?: Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
[18:05:05] gheegh: has joined #ruby
[18:06:37] clemens3: has joined #ruby
[18:07:36] dionysus69: has joined #ruby
[18:09:35] tubbo: has joined #ruby
[18:10:01] daveomcd: or perhaps the error isn't as much about my system but saying the destination's certificate is failing?
[18:10:58] Lytol: has joined #ruby
[18:12:22] jerikl: has joined #ruby
[18:18:14] anisha: has joined #ruby
[18:18:56] \void: has joined #ruby
[18:19:30] Xiti: has joined #ruby
[18:20:06] StarSeed0000: has joined #ruby
[18:21:31] dostoyevsky: > undefined method `type_suffix' for #<struct :"CommonTree type_suffix"=nil> (NoMethodError)
[18:22:00] rstandy: has joined #ruby
[18:22:01] dostoyevsky: I wonder what kind of struct data type antlr is using here
[18:22:28] apeiros: looks like a normal Struct
[18:22:52] rstandy: hello, is there a way to silence ruby deprecation warnings for a specific command line program?
[18:22:57] sameerynho: has joined #ruby
[18:23:00] apeiros: though the name looks funny
[18:23:46] apeiros: oh lol, it's not the name. it's the struct member.
[18:25:00] apeiros: dostoyevsky: the struct member's name is "CommonTree :type_suffix", not just type_suffix
[18:25:24] arkymad: has joined #ruby
[18:25:48] mr_foto: has joined #ruby
[18:25:54] jnollette: has joined #ruby
[18:30:27] dostoyevsky: apeiros: Yeah, thanks
[18:31:19] lxsameer: has joined #ruby
[18:34:10] cdg: has joined #ruby
[18:35:02] jottr_: has joined #ruby
[18:35:21] drewmcmillan: has joined #ruby
[18:40:49] n008f4g_: has joined #ruby
[18:41:16] dostoyevsky: So it wasn't too hard after all to port that antlr parser from Java to ruby... :)
[18:41:26] fr4nt1c: has joined #ruby
[18:41:43] dostoyevsky: (The grammar.g used Java syntax at places)
[18:43:28] jerikl: has joined #ruby
[18:45:01] ogres: has joined #ruby
[18:45:10] claudiuinberlin: has joined #ruby
[18:50:05] n0m4d1c: has joined #ruby
[18:50:22] hahuang61: has joined #ruby
[18:50:30] mr_foto: has joined #ruby
[18:50:33] mtkd: has joined #ruby
[18:52:36] milardovich: has joined #ruby
[18:52:38] bigblind: has joined #ruby
[18:52:52] milardov_: has joined #ruby
[18:58:45] hahuang65: has joined #ruby
[18:58:47] LightStalker: has joined #ruby
[19:00:04] ule: Hey guys, I'm trying to create a breadcrumb from a hash
[19:00:22] ule: https://repl.it/repls/ModestShowyFinance
[19:00:24] joe_from_maine: has joined #ruby
[19:01:59] fribmendes: has joined #ruby
[19:03:09] ramfjord: has joined #ruby
[19:03:28] dmitriy_: has joined #ruby
[19:03:32] apeiros: ule: you want to print the keys, not the values.
[19:04:16] apeiros: also you want breadth first, not depth. so before recurring, you should print all keys first.
[19:04:25] claudiuinberlin: has joined #ruby
[19:08:11] karapetyan: has joined #ruby
[19:08:28] dmitriy_: has joined #ruby
[19:10:53] orbyt_: has joined #ruby
[19:12:13] RougeR: has joined #ruby
[19:12:13] RougeR: has joined #ruby
[19:12:27] logoscoder: has joined #ruby
[19:12:58] ule: apeiros: ok
[19:13:31] dmitriy_: has joined #ruby
[19:17:39] jamiejackson: has joined #ruby
[19:18:31] dmitriy_: has joined #ruby
[19:20:28] ule: apeiros: at the first iteration it gives me A as key and the rest as value right
[19:20:48] ule: so, I guess after getting this A, I should imidialy start recursivelly looking at each key inside value
[19:21:12] ule: thats why I thought to call the recursion passing(v)
[19:21:24] apeiros: recursion is the right approach, yes
[19:21:47] apeiros: but since you have breadth first, you need two iterations. the first iteration is to print the current level. the second iteration is to recurse
[19:22:00] nowhereman_: has joined #ruby
[19:22:24] ule: yes, thats what I have there.. h.each (first iteration), and recursion inside that
[19:24:01] apeiros: no, that's not what you have there. you have a single iteration which recurs. that gives you depth-first
[19:24:35] cdg: has joined #ruby
[19:25:16] ule: so if I understood well, I need v.each as well
[19:25:18] ule: let me try
[19:28:08] herbmillerjr: has joined #ruby
[19:29:26] dmitriy_: has joined #ruby
[19:30:59] drewmcmillan: has joined #ruby
[19:33:32] hahuang61: has joined #ruby
[19:34:27] dmitriy_: has joined #ruby
[19:34:58] ule: apeiros: I guess now its time to call the recursion right?
[19:35:27] stairmast0r_: has joined #ruby
[19:36:24] apeiros: ule: sorry, opting for the easy solution for me for now. here's a working example: https://gist.github.com/apeiros/a81b1ff315a517bbaaac7f5f8d00492e
[19:38:49] ule: apeiros: in your example, stack is the previous level?
[19:39:06] tubbo: has joined #ruby
[19:39:24] apeiros: I'd say no. depends on your understanding of "previous level". it's more like the current location.
[19:39:27] dmitriy_: has joined #ruby
[19:39:28] raynold: has joined #ruby
[19:39:51] baweaver: Oh hey, keypaths
[19:39:53] apeiros: add debug outputs as necessary to understand what's going on. I'm a bit busy.
[19:40:47] ule: thank you very much apeiros
[19:41:21] milardovich: has joined #ruby
[19:42:30] LightStalker: has joined #ruby
[19:43:13] samort7_: has joined #ruby
[19:44:13] aufi: has joined #ruby
[19:44:45] dmitriy_: has joined #ruby
[19:45:31] baweaver: ule, apeiros: https://repl.it/repls/OrderlyUnripeFinance
[19:46:38] ule: baweaver: nice one as well. I didn't know about that reduce with 3 elements
[19:49:45] dmitriy_: has joined #ruby
[19:54:24] dmitriy_: has joined #ruby
[19:54:25] tomphp: has joined #ruby
[19:54:29] apeiros: baweaver: interesting solution. but the current version of yours is depth-first too
[19:54:36] apeiros: the example ule gave was breadth-first
[19:55:08] apeiros: I wondered whether there's a way to do it without a stack and/or without two iterations
[19:55:44] ule: I found this one googling here: https://gist.github.com/crwang/6a9d6ab3b248debb5131
[19:56:56] ule: actually, this one:
[19:56:58] ule: https://gist.github.com/dbrady/121ceecac3bef9cdd3b0
[19:57:14] alex``: has joined #ruby
[19:59:08] agent_white: has joined #ruby
[19:59:23] dmitriy_: has joined #ruby
[20:01:41] InfinityFye: has joined #ruby
[20:02:53] n0m4d1c: has joined #ruby
[20:04:29] dmitriy_: has joined #ruby
[20:05:52] marr: has joined #ruby
[20:09:30] Sambsquanch: has joined #ruby
[20:09:31] dmitriy_: has joined #ruby
[20:09:39] jerikl: has joined #ruby
[20:10:47] AJA4350: has joined #ruby
[20:11:00] claudiuinberlin: has joined #ruby
[20:12:27] ledestin: has joined #ruby
[20:12:33] Dimik: has joined #ruby
[20:14:28] dmitriy_: has joined #ruby
[20:17:08] jcalla: has joined #ruby
[20:18:43] pastorinni: has joined #ruby
[20:19:27] dmitriy_: has joined #ruby
[20:21:52] dminuoso: ule: Its not 3 elements.
[20:22:10] ule: dminuoso: what do you mean?
[20:22:15] govg: has joined #ruby
[20:22:39] ule: oh in the reduce parameters there? gotcha
[20:22:52] dminuoso: ule: In somewhat simplified terms { |(a, b)| ... } is the same as { |p| a, b = p}
[20:23:22] dminuoso: ule: So in a way it just assumes the second argument itself is an array, or something that can be coerced using to_ary
[20:24:04] dminuoso: >> f = proc{ |(a,b)| p a }; f[ [1,2,3] ]
[20:24:06] ruby[bot]: dminuoso: # => 1 ...check link for more (https://eval.in/967050)
[20:24:06] eckhardt: has joined #ruby
[20:24:08] dminuoso: >> f = proc{ |(a,b)| p b }; f[ [1,2,3] ]
[20:24:09] ruby[bot]: dminuoso: # => 2 ...check link for more (https://eval.in/967051)
[20:25:30] vutral|kali: has joined #ruby
[20:25:30] vutral|kali: has joined #ruby
[20:25:34] dminuoso: As you can see in this example, Im passing just a single argument.
[20:28:06] stairmast0r: has joined #ruby
[20:28:33] ule: When using a recursive logic, how can I return the value instead of using "puts" in the middle of the method?
[20:29:31] gheegh: has joined #ruby
[20:29:44] ule: if I add an acumulator like foo << x, or foo += x it doesn't work because I need to declare foo = '' when I start the method
[20:30:33] bmurt: has joined #ruby
[20:32:01] bmurt: has joined #ruby
[20:32:26] dminuoso: ule: Depends. If you are using a lambda you can just use "return", inside a block/proc you have to use "next" instead.
[20:32:37] dminuoso: ule: Inside a proc/block "next" semantically means return in the way you would expect it.
[20:33:39] dminuoso: ule: Personally I dont like to think of it as an "accumulator" either, because it kind of destroys the notion of what reduce/inject is algebraically.
[20:34:37] dminuoso: ule: https://wiki.haskell.org/wikiupload/5/5a/Left-fold-transformation.png - so effectively you just provide some binary operation and fold the array together.
[20:34:52] ule: humm let me try
[20:35:29] dminuoso: that argument you pass into inject is because you have this asymmetric thing for the first argument. if you dont supply an argument, then the whole thing is shifted by one
[20:35:44] dminuoso: ule: This gives rise to some powerful ideas
[20:35:47] dmitriy_: has joined #ruby
[20:36:13] dminuoso: >> prepend = -> e, a { a.unshift e }; [1,2,3,4,5].reduce([], &prepend)
[20:36:15] ruby[bot]: dminuoso: # => undefined method `unshift' for 1:Fixnum (NoMethodError) ...check link for more (https://eval.in/967052)
[20:36:34] dminuoso: >> prepend = -> a, e { a.unshift e }; [1,2,3,4,5].reduce([], &prepend)
[20:36:35] ruby[bot]: dminuoso: # => [5, 4, 3, 2, 1] (https://eval.in/967053)
[20:36:55] dminuoso: ule: this lets you cleanly separate the folding concept from the code that invokes it
[20:37:24] dminuoso: or makes it more obvious what this means
[20:37:28] dminuoso: [1,2,3,4,5].inject(&:+)
[20:37:30] dminuoso: >> [1,2,3,4,5].inject(&:+)
[20:37:31] ruby[bot]: dminuoso: # => 15 (https://eval.in/967054)
[20:40:25] dminuoso: ule: now imagine you had a function that takes a tree, and an element, and inserts that element into the tree.
[20:40:41] dminuoso: ule: you can then transform a list into that tree with just list.inject(&func)
[20:41:12] dmitriy_: has joined #ruby
[20:41:17] X-Jester: has joined #ruby
[20:41:35] hahuang61: has joined #ruby
[20:43:39] jenrzzz: has joined #ruby
[20:43:40] jenrzzz: has joined #ruby
[20:44:26] tomphp: has joined #ruby
[20:45:51] dmitriy_: has joined #ruby
[20:47:26] claudiuinberlin: has joined #ruby
[20:48:23] InfinityFye: has joined #ruby
[20:48:57] tubbo: has joined #ruby
[20:50:51] dmitriy_: has joined #ruby
[20:55:36] ule: sweet, working with Ruby is like using Vim
[20:55:42] ule: learning courve never ends
[20:55:44] mtkd: has joined #ruby
[20:55:51] dmitriy_: has joined #ruby
[20:57:18] zapata: has joined #ruby
[20:57:45] workmad3: has joined #ruby
[20:58:32] Cavallari1: has joined #ruby
[21:00:40] tomphp: has joined #ruby
[21:00:49] dmitriy_: has joined #ruby
[21:02:06] samort7: has joined #ruby
[21:02:09] sanscoeur: has joined #ruby
[21:03:14] mcr1: has joined #ruby
[21:04:18] sidx64: has joined #ruby
[21:05:52] dmitriy_: has joined #ruby
[21:08:04] jcalla: has joined #ruby
[21:10:00] bigblind: has joined #ruby
[21:10:47] dmitriy_: has joined #ruby
[21:12:23] hahuang61: has joined #ruby
[21:15:49] dmitriy_: has joined #ruby
[21:17:19] SeepingN: has joined #ruby
[21:17:22] dminuoso: >> pair = -> a, e { [e, a] }; [1,2,3,4,5].reduce([], &pair)
[21:17:23] ruby[bot]: dminuoso: # => [5, [4, [3, [2, [1, []]]]]] (https://eval.in/967068)
[21:17:29] ltem: has joined #ruby
[21:18:09] dminuoso: ule: And there's some also interesting things to look at
[21:18:42] dminuoso: >> append = -> a, e { [*a, e] }; [1,2,3,4,5].inject([], &append)
[21:18:43] ruby[bot]: dminuoso: # => [1, 2, 3, 4, 5] (https://eval.in/967071)
[21:19:16] dminuoso: Which I guess you can more compactly write as
[21:19:27] dminuoso: >> [1,2,3,4,5].reduce([], &:push)
[21:19:28] ruby[bot]: dminuoso: # => [1, 2, 3, 4, 5] (https://eval.in/967072)
[21:19:36] dminuoso: >> [1,2,3,4,5].reduce([], &:unshift)
[21:19:37] ruby[bot]: dminuoso: # => [5, 4, 3, 2, 1] (https://eval.in/967073)
[21:20:47] dmitriy_: has joined #ruby
[21:21:43] al2o3-cr: dminuoso: you don't need the ampersand for reduce/inject ;)
[21:22:02] dminuoso: al2o3-cr: I dont care to learn which magic methods happen to not need it.
[21:22:17] dminuoso: It's far too random, so & is more consistent.
[21:22:35] tomphp: has joined #ruby
[21:22:56] dminuoso: >> [1,2,3].map(:to_s)
[21:22:57] ruby[bot]: dminuoso: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/967079)
[21:23:03] dminuoso: >> [1,2,3].select(:to_s)
[21:23:04] ruby[bot]: dminuoso: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/967080)
[21:24:43] madgen: has joined #ruby
[21:25:49] dmitriy_: has joined #ruby
[21:26:13] jerikl: has joined #ruby
[21:27:48] tomphp: has joined #ruby
[21:28:23] jcalla: has joined #ruby
[21:30:10] [Butch]: has joined #ruby
[21:30:48] dmitriy_: has joined #ruby
[21:31:25] nowhere_man: has joined #ruby
[21:35:09] sanscoeur: has joined #ruby
[21:35:48] dmitriy_: has joined #ruby
[21:36:43] jenrzzz: has joined #ruby
[21:36:43] leitz: has joined #ruby
[21:36:43] jenrzzz: has joined #ruby
[21:37:56] pastorinni: has joined #ruby
[21:40:48] dmitriy_: has joined #ruby
[21:40:53] madgen_: has joined #ruby
[21:45:48] fribmendes: has joined #ruby
[21:45:52] dmitriy_: has joined #ruby
[21:49:40] tomphp: has joined #ruby
[21:50:48] dmitriy_: has joined #ruby
[21:51:06] go|dfish: has joined #ruby
[21:51:07] cdg: has joined #ruby
[21:56:09] dmitriy_: has joined #ruby
[21:57:36] tomphp: has joined #ruby
[21:57:56] mtkd: has joined #ruby
[21:58:58] tomphp: has joined #ruby
[22:00:27] n0m4d1c: has joined #ruby
[22:00:47] dmitriy_: has joined #ruby
[22:02:51] jnollette: has joined #ruby
[22:05:31] jnollette: has joined #ruby
[22:05:50] dmitriy_: has joined #ruby
[22:10:48] dmitriy_: has joined #ruby
[22:10:56] jaruga: has joined #ruby
[22:11:25] leitz: Can you use start_with? and a regexp? Trying to match two digits and an underscore.
[22:11:44] gizmore: leitz: use regex with ^ (start marker) ?
[22:12:33] leitz: gizmore, that's Plan B. I though the ^ also negated the match.
[22:12:41] leitz: Though I'm easily confused.
[22:12:51] gizmore: in a char class [^1-3] means NOT 1-3
[22:13:06] gizmore: but else the ^ is "text start" or string start or whatever
[22:13:25] gizmore: like /^[0-9]{2}_/iD
[22:13:29] leitz: Ah, so /^[0-9][0-9]_/ should do me.
[22:13:36] gizmore: mine is nice :P
[22:13:40] gizmore: mine is nicer :P *
[22:13:48] leitz: what's the "iD" at the end?
[22:14:02] gizmore: caseInsensitive and D is something for newlines
[22:14:17] memo1: has joined #ruby
[22:14:20] gizmore: lets google for regex modifiers
[22:14:50] gizmore: D is for $/end behaviour
[22:14:51] workmad3: has joined #ruby
[22:14:56] gizmore: at least in PHP
[22:15:08] tomphp: has joined #ruby
[22:15:13] gizmore: like /^foo$/D matches only end of all the lines
[22:15:18] leitz: and shell. There's more to the line, i just need to drop it if matched.
[22:15:29] gizmore: and /^foo$/ matches also every foo\n
[22:15:50] dmitriy_: has joined #ruby
[22:15:53] gizmore: ommiting /D often is not what you want
[22:16:04] gizmore: (in my php experience so far)
[22:20:52] dmitriy_: has joined #ruby
[22:20:54] leitz: In this case I can drop the entire line.
[22:21:13] leitz: Matching from ^[0-9]{2}_
[22:21:44] gizmore: looks fine to me
[22:22:27] gizmore: if you want to make your sequel workers ponder, use ^[2106574983][21768ß5943][_]
[22:22:33] gizmore: if you want to make your sequel workers ponder, use ^[2106574983][2176805943][_] *
[22:23:01] elomatreb: Take care that ^ in Ruby means "Start of line", not "Start of string" (which would be \A)
[22:23:25] gizmore: elomatreb: leitz: which might be changed with a modifier?
[22:23:29] leitz: elomatreb, yup. In this case string and line start in the same place.
[22:24:20] elomatreb: Oh, I seem to have lost my scrollback/context
[22:25:52] dmitriy_: has joined #ruby
[22:27:12] adlerdias: has joined #ruby
[22:28:00] leitz: Here's the final line so far: if not line.match(/^[0-9]{2}_/)
[22:28:52] leitz: I'm filtering out lines like: 00_Prologue
[22:29:39] tomphp: has joined #ruby
[22:30:02] beerich: has joined #ruby
[22:30:52] dmitriy_: has joined #ruby
[22:31:26] elomatreb: \d is a shortcut for [0-9], but that's just style
[22:32:59] karapetyan: has joined #ruby
[22:34:14] bmurt: has joined #ruby
[22:34:40] beerich: Anybody have a solid grasp on setting instance_variables?
[22:34:51] baweaver: @var = value
[22:35:03] baweaver: Though I assume you mean something a bit more dynamic.
[22:35:15] baweaver: What's the end goal?
[22:35:23] beerich: I have an incoming hash
[22:35:33] beerich: I want to assign the same ivars to the values
[22:35:35] baweaver: leitz: use `unless`. Also, english `not` is not really used
[22:35:49] dmitriy_: has joined #ruby
[22:36:03] beerich: https://gist.github.com/daBee/0aa73f766b781070d6fea6fe547df40b
[22:36:39] baweaver: What's the issue?
[22:36:46] beerich: nothing is being assigned
[22:36:57] beerich: line 15 is the culprit
[22:37:27] dviola: has joined #ruby
[22:37:49] beerich: I just added teh output
[22:40:26] al2o3-cr: >> k = :foo; instance_variable_set "@#{k.to_sym}", 7
[22:40:32] ruby[bot]: al2o3-cr: # => 7 (https://eval.in/967095)
[22:40:48] dmitriy_: has joined #ruby
[22:40:56] al2o3-cr: beerich: you're missing the @
[22:42:06] beerich: man I thought i tried that
[22:42:23] beerich: why is it not already a symbol coming in as a hash key?
[22:43:40] beerich: just tested it and it's already a symbol
[22:44:24] al2o3-cr: but instance variables require @ prepended to them
[22:44:36] beerich: ok the instance variable @ sign, yes I get that part
[22:44:47] beerich: but a symbol coerced to a symbol makes no sense
[22:45:07] beerich: and i might have assumed the method name would have flushed that out
[22:45:10] al2o3-cr: i'd didn't see your hash at the bottom
[22:45:13] FrostCandy: has joined #ruby
[22:45:24] beerich: ya it arrives to the method as a symbol
[22:45:33] al2o3-cr: but your right it doesn't need coercing
[22:46:12] beerich: I'm messing with it now
[22:47:40] beerich: ok this works: instance_variable_set("@#{k}", v) if instance_variables.include?("@#{k}".to_sym)
[22:47:53] beerich: ok thanks for the guidance
[22:57:45] vutral|kali: has joined #ruby
[22:57:45] vutral|kali: has joined #ruby
[23:01:14] tsht: has joined #ruby
[23:01:58] [Butch]: has joined #ruby
[23:02:04] dmitriy_: has joined #ruby
[23:02:21] cagomez: has joined #ruby
[23:03:04] jenrzzz_: has joined #ruby
[23:06:46] DTZUZO: has joined #ruby
[23:07:05] dmitriy_: has joined #ruby
[23:12:05] dmitriy_: has joined #ruby
[23:15:29] druonysus: has joined #ruby
[23:17:06] dmitriy_: has joined #ruby
[23:19:04] Mike11: has joined #ruby
[23:22:03] dmitriy_: has joined #ruby
[23:24:40] drewmcmillan: has joined #ruby
[23:25:01] karapetyan: has joined #ruby
[23:26:07] jerikl: has joined #ruby
[23:26:57] apeiros: has joined #ruby
[23:27:05] dmitriy_: has joined #ruby
[23:27:17] bmurt: has joined #ruby
[23:32:03] dmitriy_: has joined #ruby
[23:32:49] eckhardt: has joined #ruby
[23:34:36] karapetyan: has joined #ruby
[23:35:26] cdg: has joined #ruby
[23:37:08] dmitriy_: has joined #ruby
[23:42:04] dmitriy_: has joined #ruby
[23:43:24] hahuang65: has joined #ruby
[23:43:39] hahuang61: has joined #ruby
[23:44:58] gheegh: has joined #ruby
[23:45:03] milardovich: has joined #ruby
[23:46:09] goatish: has joined #ruby
[23:46:09] hahuang65: has joined #ruby
[23:47:03] dmitriy_: has joined #ruby
[23:47:29] hahuang65: has joined #ruby
[23:51:31] hahuang65: has joined #ruby
[23:51:40] apeiros: has joined #ruby
[23:52:23] dmitriy_: has joined #ruby
[23:52:26] hahuang65: has joined #ruby
[23:53:02] phaul: has joined #ruby
[23:54:11] hahuang65: has joined #ruby
[23:54:31] SteenJobs: has joined #ruby
[23:57:01] hahuang65: has joined #ruby
[23:57:02] dmitriy_: has joined #ruby
[23:58:51] leitz: baweaver, "unless" is better. When I have to negate I prefer english to symbol, though.
[23:58:54] jenrzzz: has joined #ruby
[23:59:17] hahuang65: has joined #ruby
[23:59:18] leitz: Brain mostly dead.