« Back to channel list

#ruby - 06 March 2018

« Back 1 day Forward 1 day »
[00:00:20] sanscoeur: has joined #ruby
[00:02:05] dmitriy_: has joined #ruby
[00:02:47] hahuang65: has joined #ruby
[00:03:09] n0m4d1c: has joined #ruby
[00:03:21] GodFather: has joined #ruby
[00:03:35] tcopeland: has joined #ruby
[00:05:03] hahuang65: has joined #ruby
[00:06:49] cschneid: has joined #ruby
[00:07:04] dmitriy_: has joined #ruby
[00:07:25] leitz: Dang. Have I mentioned i hate unicode?
[00:09:05] mozzarella: do you want me to grep my log files?
[00:10:21] leitz: No, trying to understand my "git status" line. If i "ls" the file is: 1429_180_0745_Casimir_District_Saorsa.txt
[00:10:27] apeiros: has joined #ruby
[00:10:36] AJA4350: has joined #ruby
[00:10:41] leitz: The git status line shows: # new file: "\357\273\2771429_180_0745_Casimir_District_Saorsa.txt"
[00:10:56] eckhardt: has joined #ruby
[00:12:02] leitz: Code: https://gist.github.com/LeamHall/43513fb5af09fbe0f0522fff9c115c56
[00:12:05] dmitriy_: has joined #ruby
[00:12:36] arescorpio: has joined #ruby
[00:13:14] leitz: Added a comment with the start of the chapter, showing what it was before the new file was written.
[00:15:00] tjbp: has joined #ruby
[00:15:13] leitz: one part I don't understand is the characters; I checked "new_file_name" as I wrote the code, and whatever \357\273\277 are they aren't showing up as printable.
[00:17:04] arkymad: has joined #ruby
[00:17:06] leitz: BOM; Byte order marking. From a stack overflow on C.
[00:17:07] dmitriy_: has joined #ruby
[00:17:55] leitz: Which is one of the reasons I don't like UTF-8.
[00:18:00] ikopico_: has joined #ruby
[00:18:16] n0m4d1c: has joined #ruby
[00:18:53] leitz: The BOM or me not liking UTF-8? :)
[00:19:09] apeiros: has joined #ruby
[00:21:46] eckhardt: has joined #ruby
[00:22:05] dmitriy_: has joined #ruby
[00:22:36] naprimer: has joined #ruby
[00:23:23] kapil___: has joined #ruby
[00:23:40] Psybur: has joined #ruby
[00:27:03] dmitriy_: has joined #ruby
[00:27:46] jottr: has joined #ruby
[00:32:23] dmitriy_: has joined #ruby
[00:33:05] hahuang65: has joined #ruby
[00:36:25] leitz: And this removed the entire line. new_file_name = new_file_name.delete("^\xEF\xBB\xBF")
[00:37:05] dmitriy_: has joined #ruby
[00:37:07] hahuang61: has joined #ruby
[00:37:59] cadillac_: has joined #ruby
[00:38:02] n0m4d1c: has joined #ruby
[00:39:04] hahuang65: has joined #ruby
[00:40:39] apeiros: has joined #ruby
[00:41:00] leitz: This seems to work: new_file_name = new_file_name.gsub(/.*\[/, '[')
[00:41:34] hahuang65: has joined #ruby
[00:42:06] dmitriy_: has joined #ruby
[00:42:28] konsolebox: has joined #ruby
[00:42:33] Mr_Tea: has joined #ruby
[00:43:49] hahuang65: has joined #ruby
[00:45:46] hahuang65: has joined #ruby
[00:46:10] Mr_Tea: https://gist.github.com/25c7a44cdb4f4ca1d8a2506c74cc7a24 any tips on how to refactor my chip8 emulator? it works, now it's time to make it good.
[00:47:05] dmitriy_: has joined #ruby
[00:47:49] nowhere_man: has joined #ruby
[00:48:15] bonhoeffer: has joined #ruby
[00:49:13] baweaver: Mr_Tea: better variable names for one.
[00:49:49] baweaver: In nread_key and read_key you're using return with a case statement
[00:49:58] baweaver: Ruby implies returns
[00:50:20] baweaver: It also looks like those two methods are heavily duplicated
[00:50:32] baweaver: What I would do is extract that into a key mapping
[00:51:14] baweaver: KEY_MAP = {'1' => 1 .... }
[00:51:26] Mr_Tea: one does it async and the other doesnt
[00:51:38] baweaver: Sure, but the case statements are the exact same.
[00:52:02] dmitriy_: has joined #ruby
[00:52:36] phaul: baweaver: split up that 100+ lines functions to small chunks that are function calls named after their purpose
[00:53:35] phaul: it will become much more readable
[00:53:46] baweaver: Y'mean Mr_Tea
[00:54:03] phaul: yeah sorry :)
[00:54:09] baweaver: but I would agree to break out all the case mess
[00:54:27] baweaver: Case statements should not be used in lieu of methods
[00:54:29] Mr_Tea: could I use a map for that as well?
[00:54:30] phaul: plus name all the magic values
[00:55:05] baweaver: For that one, probably not, you want to break it into named methods
[00:55:18] baweaver: if you want to know what to name them, ask a question: what does this code do?
[00:55:51] minimalism: has joined #ruby
[00:55:54] baweaver: Such as you have one area that says "sprite display" in a comment
[00:56:15] baweaver: Also Ruby people tend to not use `for ... in`
[00:56:21] baweaver: Mostly it's each and Enumerable
[00:56:25] apeiros: has joined #ruby
[00:56:26] baweaver: &ri Enumerable
[00:56:26] `derpy: http://ruby-doc.org/core-2.4.1/Enumerable.html
[00:57:05] dmitriy_: has joined #ruby
[00:57:10] baweaver: but all the variable names like @v are impossible to follow unless you know the domain.
[00:57:40] Mr_Tea: that one should be something like registers
[00:57:52] baweaver: Also you can multiply strings
[00:57:59] hahuang65: has joined #ruby
[00:58:05] milardovich: has joined #ruby
[00:58:06] baweaver: >> ' ' * 10
[00:58:09] ruby[bot]: baweaver: # => " " (https://eval.in/967105)
[00:58:19] baweaver: easier than counting all those danged things.
[00:58:42] Mr_Tea: for what? you lost me
[00:58:51] baweaver: @window.addstr(" ")
[00:59:16] Mr_Tea: I just used C-u 64 for that one lol
[00:59:28] baweaver: chip8.draw_graphics unless chip8.drawflag.zero?
[00:59:46] baweaver: suffix conditionals, unless is inverted if, and zero? is a method on Integers
[01:01:39] baweaver: Also everything in Ruby is an expression
[01:01:57] baweaver: >> a = if true; 1; else 2 end
[01:01:58] ruby[bot]: baweaver: # => 1 (https://eval.in/967106)
[01:02:04] dmitriy_: has joined #ruby
[01:02:32] baweaver: meaning that you could: @pc += if ....
[01:02:32] Mr_Tea: so everything returns a value?
[01:02:41] baweaver: most everything
[01:02:48] baweaver: puts returns nil, that one's fun
[01:03:18] Mr_Tea: makes sense all you want from puts is the side effects
[01:03:23] hahuang65: has joined #ruby
[01:03:50] phaul: Mr_Tea: one other suggestion: are you familiar with any of the testing frameworks? rspec, minitest etc?
[01:04:12] SeepingN: shame on you! ;)
[01:04:44] baweaver: Check the channel topic, I left a book list up there.
[01:04:53] baweaver: There's a good RSpec book mentioned in there
[01:04:57] phaul: Usually before a big refactor it's worth having some tests at least.
[01:05:00] Mr_Tea: ooo books
[01:05:40] Axsuul: has joined #ruby
[01:06:13] phaul: it's always reassuring that you know your code is at least as good as before :)
[01:06:38] Mr_Tea: I didn't really read anything in depth, I just wanted to do a big project in ruby before I needed it for a hackathon
[01:07:07] dmitriy_: has joined #ruby
[01:07:19] baweaver: Mr_Tea: The fast route, since it looks like you know programming already: Eloquent Ruby, Effective RSpec
[01:07:38] baweaver: Entire point of Eloquent is how to Ruby like a Rubyist
[01:08:32] apeiros: has joined #ruby
[01:08:46] jottr_: has joined #ruby
[01:08:51] memo1: has joined #ruby
[01:10:16] Mr_Tea: I like those programming books for programmers
[01:12:07] dmitriy_: has joined #ruby
[01:12:58] druonysus: has joined #ruby
[01:12:58] druonysus: has joined #ruby
[01:17:09] dmitriy_: has joined #ruby
[01:17:30] rocx: has joined #ruby
[01:18:29] jenrzzz: has joined #ruby
[01:18:29] jenrzzz: has joined #ruby
[01:22:07] dmitriy_: has joined #ruby
[01:23:08] SeepingN: Practical Object-Oriented Design in Ruby
[01:24:08] SeepingN: and "Learn to Program, 2nd Edition"
[01:26:17] eckhardt: has joined #ruby
[01:27:06] dmitriy_: has joined #ruby
[01:27:08] hahuang65: has joined #ruby
[01:32:06] dmitriy_: has joined #ruby
[01:32:41] apeiros: has joined #ruby
[01:35:01] milardovich: has joined #ruby
[01:37:04] dmitriy_: has joined #ruby
[01:37:09] cagomez: has joined #ruby
[01:37:12] n0m4d1c: has joined #ruby
[01:41:53] SteenJobs: has joined #ruby
[01:42:08] dmitriy_: has joined #ruby
[01:42:13] gnufied: has joined #ruby
[01:44:16] karapetyan: has joined #ruby
[01:44:33] SynSynack: has joined #ruby
[01:45:48] Mr_Tea: thanks for all the advice I'll be back later this week, hopefully with some eloquent ruby
[01:45:55] gheegh: has joined #ruby
[01:47:07] dmitriy_: has joined #ruby
[01:50:33] Axsuul: has joined #ruby
[01:52:02] milardovich: has joined #ruby
[01:52:05] dmitriy_: has joined #ruby
[01:53:27] TvL2386: has joined #ruby
[01:56:52] hahuang65: has joined #ruby
[01:57:06] dmitriy_: has joined #ruby
[01:58:27] TvL2386: has joined #ruby
[02:01:21] Xiti: has joined #ruby
[02:02:07] dmitriy_: has joined #ruby
[02:06:19] raynold: has joined #ruby
[02:07:04] dmitriy_: has joined #ruby
[02:08:38] cschneid: has joined #ruby
[02:09:00] jottr_: has joined #ruby
[02:11:16] Azure: has joined #ruby
[02:12:07] dmitriy_: has joined #ruby
[02:12:12] bmurt: has joined #ruby
[02:17:09] dmitriy_: has joined #ruby
[02:22:06] dmitriy_: has joined #ruby
[02:27:06] dmitriy_: has joined #ruby
[02:27:17] dinfuehr_: has joined #ruby
[02:32:15] cdg: has joined #ruby
[02:37:15] hahuang61: has joined #ruby
[02:43:55] postmodern: has joined #ruby
[02:44:06] jottr_: has joined #ruby
[02:48:20] apeiros: has joined #ruby
[02:52:22] jottr_: has joined #ruby
[02:54:56] gizmore|2: has joined #ruby
[02:55:08] apeiros: has joined #ruby
[02:58:52] jottr_: has joined #ruby
[03:00:46] cadillac_: has joined #ruby
[03:06:06] jottr_: has joined #ruby
[03:06:48] cadillac_: has joined #ruby
[03:11:23] cpallares: has joined #ruby
[03:18:21] bmurt: has joined #ruby
[03:18:52] hahuang65: has joined #ruby
[03:19:18] jottr_: has joined #ruby
[03:21:20] cpallares: has joined #ruby
[03:21:38] IanMalcolm: has joined #ruby
[03:21:54] Map: has joined #ruby
[03:22:50] cagomez: has joined #ruby
[03:23:13] apeiros: has joined #ruby
[03:23:41] kapil___: has joined #ruby
[03:26:22] suhdood: has joined #ruby
[03:27:00] darkhanb: has joined #ruby
[03:31:44] jottr_: has joined #ruby
[03:37:18] apeiros: has joined #ruby
[03:38:31] nielsk: has joined #ruby
[03:39:36] hahuang61: has joined #ruby
[03:41:09] nielsk: has joined #ruby
[03:41:20] minimalism: has joined #ruby
[03:42:21] jottr_: has joined #ruby
[03:43:08] konsolebox: has joined #ruby
[03:44:01] howdoi: has joined #ruby
[03:46:32] bigblind: has joined #ruby
[03:47:10] nielsk: has joined #ruby
[03:47:51] apeiros: has joined #ruby
[03:47:58] govg: has joined #ruby
[03:49:09] ogres: has joined #ruby
[03:55:34] jottr_: has joined #ruby
[03:59:18] milardovich: has joined #ruby
[04:03:41] jottr_: has joined #ruby
[04:03:56] milardovich: has joined #ruby
[04:04:17] hahuang65: has joined #ruby
[04:05:01] bonhoeffer: has joined #ruby
[04:10:51] QpQ4_: has joined #ruby
[04:12:29] jottr_: has joined #ruby
[04:13:02] apeiros: has joined #ruby
[04:13:28] netherwolfe_: has joined #ruby
[04:14:04] eckhardt: has joined #ruby
[04:14:10] Ryzokuken: has joined #ruby
[04:17:29] QpQ4__: has joined #ruby
[04:17:35] cpallares: has joined #ruby
[04:19:23] hahuang65: has joined #ruby
[04:21:16] jottr_: has joined #ruby
[04:22:45] orbyt_: has joined #ruby
[04:24:15] yadnesh: has joined #ruby
[04:25:14] trautwein: has joined #ruby
[04:27:43] jottr_: has joined #ruby
[04:34:16] hahuang65: has joined #ruby
[04:34:50] hahuang61: has joined #ruby
[04:40:40] jottr_: has joined #ruby
[04:47:35] jottr_: has joined #ruby
[04:47:47] cdg: has joined #ruby
[04:47:55] rippa: has joined #ruby
[04:49:20] hahuang65: has joined #ruby
[04:52:46] meinside: has joined #ruby
[04:57:09] Axsuul: has joined #ruby
[04:57:35] jottr_: has joined #ruby
[04:59:53] jerikl: has joined #ruby
[05:01:49] darkhanb_: has joined #ruby
[05:04:23] hahuang65: has joined #ruby
[05:06:38] Cohedrin: has joined #ruby
[05:06:45] luminous: has joined #ruby
[05:08:50] hndk: has joined #ruby
[05:09:06] hahuang61: has joined #ruby
[05:10:38] darkhanb: has joined #ruby
[05:11:46] jottr_: has joined #ruby
[05:18:34] Ryzokuken: has joined #ruby
[05:19:22] hahuang65: has joined #ruby
[05:19:35] apeiros: has joined #ruby
[05:20:29] jottr_: has joined #ruby
[05:29:36] apeiros: has joined #ruby
[05:33:23] jottr_: has joined #ruby
[05:34:28] hahuang65: has joined #ruby
[05:37:40] sidx64: has joined #ruby
[05:37:59] apeiros: has joined #ruby
[05:38:10] ramfjord: has joined #ruby
[05:38:40] eckhardt: has joined #ruby
[05:40:13] sidx64: has joined #ruby
[05:47:19] iMadper: has joined #ruby
[05:48:28] jottr_: has joined #ruby
[05:49:21] hahuang65: has joined #ruby
[05:50:49] dhollinger: has joined #ruby
[05:51:04] apeiros: has joined #ruby
[05:55:16] eckhardt: has joined #ruby
[05:56:55] jenrzzz: has joined #ruby
[05:56:55] jenrzzz: has joined #ruby
[05:58:00] bigblind: has joined #ruby
[05:59:47] apeiros: has joined #ruby
[06:01:30] anisha: has joined #ruby
[06:02:52] jottr_: has joined #ruby
[06:03:54] sidx64: has joined #ruby
[06:08:23] sidx64: has joined #ruby
[06:09:29] Mon_Ouie: has joined #ruby
[06:09:45] halt: has joined #ruby
[06:10:41] Mon_Ouie: has joined #ruby
[06:12:46] jottr_: has joined #ruby
[06:17:15] aufi: has joined #ruby
[06:19:26] hahuang65: has joined #ruby
[06:23:25] jottr_: has joined #ruby
[06:32:48] bigblind: has joined #ruby
[06:34:30] hahuang65: has joined #ruby
[06:34:47] jottr_: has joined #ruby
[06:35:34] n008f4g_: has joined #ruby
[06:38:51] sidx64_: has joined #ruby
[06:39:42] sammi`: has joined #ruby
[06:40:58] Gucciferal: has joined #ruby
[06:43:51] sidx64: has joined #ruby
[06:44:01] jottr_: has joined #ruby
[06:49:26] hahuang65: has joined #ruby
[06:59:26] kapil___: has joined #ruby
[06:59:37] jottr_: has joined #ruby
[06:59:54] itp_student|3290: has joined #ruby
[07:04:45] hahuang65: has joined #ruby
[07:06:43] rabajaj: has joined #ruby
[07:06:52] IanMalcolm: has joined #ruby
[07:07:47] jottr_: has joined #ruby
[07:08:30] cdg: has joined #ruby
[07:12:13] mtkd: has joined #ruby
[07:12:53] sidx64_: has joined #ruby
[07:15:28] sidx64: has joined #ruby
[07:15:46] jottr_: has joined #ruby
[07:19:31] hahuang65: has joined #ruby
[07:20:38] conta: has joined #ruby
[07:22:04] _aeris_: has joined #ruby
[07:24:51] jottr_: has joined #ruby
[07:30:03] guardianx: has joined #ruby
[07:32:07] aguestuser: has joined #ruby
[07:34:19] hahuang65: has joined #ruby
[07:34:48] alfiemax: has joined #ruby
[07:34:53] pwnd_nsfw: has joined #ruby
[07:35:44] jottr_: has joined #ruby
[07:37:10] yokel: has joined #ruby
[07:38:01] alfiemax: has joined #ruby
[07:38:32] hahuang61: has joined #ruby
[07:40:53] ramfjord: has joined #ruby
[07:42:06] suukim: has joined #ruby
[07:42:19] devil_tux: has joined #ruby
[07:43:01] yokel: has joined #ruby
[07:44:34] cdg: has joined #ruby
[07:47:58] dionysus69: has joined #ruby
[07:49:36] hahuang65: has joined #ruby
[07:50:38] jottr_: has joined #ruby
[07:51:42] alfiemax: has joined #ruby
[07:52:16] karapetyan: has joined #ruby
[07:58:03] Dimik: has joined #ruby
[07:58:34] yokel: has joined #ruby
[07:58:54] jottr_: has joined #ruby
[08:04:21] hahuang65: has joined #ruby
[08:04:46] aufi: has joined #ruby
[08:07:29] clemens3: has joined #ruby
[08:08:19] schneider-: has joined #ruby
[08:10:12] jottr_: has joined #ruby
[08:10:19] aufi: has joined #ruby
[08:12:12] tAn: has joined #ruby
[08:15:14] yokel: has joined #ruby
[08:18:38] jottr_: has joined #ruby
[08:19:24] hahuang65: has joined #ruby
[08:20:21] m27frogy: has joined #ruby
[08:21:06] yokel: has joined #ruby
[08:21:06] melodia[m]: has joined #ruby
[08:22:03] guardianx: has joined #ruby
[08:23:23] guardianx: has joined #ruby
[08:25:11] andikr: has joined #ruby
[08:27:52] yokel: has joined #ruby
[08:29:20] jottr_: has joined #ruby
[08:29:43] bigblind: has joined #ruby
[08:32:07] chihhsin: has joined #ruby
[08:34:32] hahuang65: has joined #ruby
[08:37:41] burgestrand: has joined #ruby
[08:39:39] yokel: has joined #ruby
[08:40:24] claudiuinberlin: has joined #ruby
[08:41:07] reber: has joined #ruby
[08:43:29] hahuang61: has joined #ruby
[08:43:52] DTZUZO: has joined #ruby
[08:43:59] jottr_: has joined #ruby
[08:48:56] aupadhye: has joined #ruby
[08:49:12] tomphp: has joined #ruby
[08:49:22] hahuang65: has joined #ruby
[08:50:39] jottr_: has joined #ruby
[08:52:00] yokel: has joined #ruby
[08:52:47] nowhere_man: has joined #ruby
[08:53:56] DTZUZO: has joined #ruby
[08:57:55] burgestrand: has joined #ruby
[08:58:39] jottr_: has joined #ruby
[08:58:44] Fusselgesicht: has joined #ruby
[09:01:11] zapata: has joined #ruby
[09:03:30] DTZUZO: has joined #ruby
[09:04:23] hahuang65: has joined #ruby
[09:06:08] jottr_: has joined #ruby
[09:07:54] Mike11: has joined #ruby
[09:08:08] sauvin: has joined #ruby
[09:09:53] hahuang61: has joined #ruby
[09:09:54] TvL2386: has joined #ruby
[09:12:05] RougeR: has joined #ruby
[09:12:05] RougeR: has joined #ruby
[09:12:57] marr: has joined #ruby
[09:13:50] DTZUZO: has joined #ruby
[09:19:42] hahuang65: has joined #ruby
[09:19:47] sidx64: has joined #ruby
[09:20:02] logoscoder_: has joined #ruby
[09:20:16] guille-moe: has joined #ruby
[09:21:39] cdg: has joined #ruby
[09:22:37] DTZUZO: has joined #ruby
[09:24:34] tomphp: has joined #ruby
[09:29:25] DTZUZO: has joined #ruby
[09:31:48] Beams: has joined #ruby
[09:34:32] hahuang65: has joined #ruby
[09:36:17] apeiros: has joined #ruby
[09:39:21] hahuang61: has joined #ruby
[09:44:59] sidx64: has joined #ruby
[09:49:23] hahuang65: has joined #ruby
[09:51:51] cdg: has joined #ruby
[09:53:50] nfk: has joined #ruby
[09:57:53] alfiemax: has joined #ruby
[10:00:34] jottr_: has joined #ruby
[10:01:30] nielsk: has joined #ruby
[10:04:31] hahuang65: has joined #ruby
[10:08:50] DTZUZO: has joined #ruby
[10:08:58] jottr_: has joined #ruby
[10:10:09] jenrzzz: has joined #ruby
[10:10:09] jenrzzz: has joined #ruby
[10:10:59] sidx64: has joined #ruby
[10:11:45] alex``: has joined #ruby
[10:19:27] sidx64: has joined #ruby
[10:19:51] hahuang65: has joined #ruby
[10:21:44] ldepandis: has joined #ruby
[10:22:25] jottr_: has joined #ruby
[10:27:24] lxsameer: has joined #ruby
[10:34:19] jaruga: has joined #ruby
[10:34:22] hahuang65: has joined #ruby
[10:34:59] agent_white: if ruby was a physical object, what would it be?
[10:35:42] tobiasvl: a red gemstone
[10:35:54] dminuoso: agent_white: http://cdn2.momjunction.com/wp-content/uploads/2014/05/Zig-Zag-Paper-Strips.jpg
[10:37:49] hahuang61: has joined #ruby
[10:38:03] karapetyan: has joined #ruby
[10:41:23] sidx64: has joined #ruby
[10:41:27] eb0t: has joined #ruby
[10:42:06] agent_white: ooo i would wield both! i was thinking silly putty.
[10:42:45] dminuoso: agent_white: Honestly I've found this picture to be fitting: https://rot47.net/_s/upload/2013/10/31/1fdf757bdbe24d106e17d3c96d167b8a.jpg
[10:43:01] dminuoso: (Note that Haskell is so advanced, it looks like alien tech compared to the rest)
[10:43:42] adlerdias: has joined #ruby
[10:46:43] sidx64: has joined #ruby
[10:47:45] schneider-: has joined #ruby
[10:48:19] agent_white: mushrooms would be a rough cutting utensil, unlike the others.
[10:49:26] hahuang65: has joined #ruby
[10:52:03] apeiros: dminuoso: they should have put a supersonic screwdriver as the pic for haskell
[10:52:26] apeiros: oh, just sonic, not supersonic.
[10:53:18] dminuoso: (Note when I say "advanced" I dont mean to say better, just that its technology simply far ahead)
[10:53:26] dminuoso: apeiros: Heh
[10:56:20] goatish: has joined #ruby
[10:56:42] amatas: has joined #ruby
[10:57:31] thesubr00t: has joined #ruby
[10:58:56] eb0t: has joined #ruby
[10:59:57] thesubr00t: I have an object services that I want to test using Rspec, but I don't know what is the proper way to do that.
[11:00:02] tsht: has joined #ruby
[11:00:06] thesubr00t: Here is the service https://gist.github.com/anonymous/288914a57fdd13b7794cd0eae2ed7605
[11:00:25] dminuoso: thesubr00t: Test behavior.
[11:00:27] eblip: has joined #ruby
[11:02:28] thesubr00t: dminuoso, the service is responsible for generating a CSV file, does that mean that I should compare the result with a pregenerated file?
[11:02:55] dminuoso: thesubr00t: Sure that sounds great.
[11:03:11] dminuoso: thesubr00t: Though the question is what you are testing specifically.
[11:03:40] dminuoso: thesubr00t: For ExportSurveyResponsesService I would probably mock SurveyAnnexService, and ensure that it gets called.
[11:04:22] hahuang65: has joined #ruby
[11:05:00] fribmendes: has joined #ruby
[11:05:01] thesubr00t: dminuoso, I've tried with instance_double & recieve(:call) but I get:
[11:05:02] thesubr00t: (InstanceDouble(ExportSurveyResponsesService::SurveyAnnexService) (anonymous)).new(*(any args))
[11:05:02] thesubr00t: expected: 1 time with any arguments
[11:05:02] thesubr00t: received: 0 times with any arguments
[11:05:17] thesubr00t: same fr :new
[11:05:36] drewmcmillan: has joined #ruby
[11:07:15] leitz: has joined #ruby
[11:08:10] thesubr00t: dminuoso, here is the spec file so far export_survey_responses_service.rb
[11:08:39] dminuoso: thesubr00t: Though strictly speaking I wouldnt have any "Service" module to begin with.
[11:08:46] dminuoso: "Service" is a ruby way of saying "global singleton"
[11:09:18] thesubr00t: dminuoso, Its a Rails service
[11:09:35] dminuoso: thesubr00t: Still.
[11:09:59] dminuoso: thesubr00t: Global singletons create invisible dependencies and hidden global state.
[11:10:29] tvw: has joined #ruby
[11:10:37] thesubr00t: dminuoso, So how should I implement that?
[11:12:26] dminuoso: thesubr00t: You just pass things. Services are to controllers what helpers are to views.
[11:13:22] thesubr00t: dminuoso, Ok thanks :)
[11:14:11] dminuoso: thesubr00t: Thats my personal opinion anyhow. The majority of rails people seem to be sold on the idea of using global mutable state to solve problem, magically injected globally available helpers, and invisible callbacks to control behavior.
[11:14:59] thesubr00t: dminuoso, I get your opinion :)
[11:15:52] mtkd: has joined #ruby
[11:17:26] sidx64: has joined #ruby
[11:18:13] ianmalcolm_: has joined #ruby
[11:18:31] tbuehlmann: I'm okay with "services" or command objects ¯\_(ツ)_/¯
[11:19:22] hahuang65: has joined #ruby
[11:21:12] dminuoso: tbuehlmann: command objects - you mean "functions" right? :P
[11:22:40] Cavallari: has joined #ruby
[11:22:54] dminuoso: tbuehlmann: The thing is, they tend to be easier to test. Assume some: def Q.conn(config); @conn ||= Connection.new(config); end;
[11:23:20] dminuoso: This is just memoization, I dont mind this.
[11:23:31] Papierkorb: has joined #ruby
[11:24:16] alfiemax_: has joined #ruby
[11:25:45] drewmcmillan: has joined #ruby
[11:27:29] sidx64: has joined #ruby
[11:29:43] rrutkowski: has joined #ruby
[11:30:05] milardovich: has joined #ruby
[11:31:19] phaul: has joined #ruby
[11:32:39] logoscoder_: has joined #ruby
[11:34:15] rrutkowski: has joined #ruby
[11:35:02] hahuang61: has joined #ruby
[11:39:31] karapetyan: has joined #ruby
[11:40:20] ramfjord: has joined #ruby
[11:42:01] schneider-: has joined #ruby
[11:43:36] InfinityFye: has joined #ruby
[11:44:34] InfinityFye: has left #ruby: ()
[11:44:49] shinnya: has joined #ruby
[11:45:46] sidx64: has joined #ruby
[11:47:31] jenrzzz: has joined #ruby
[11:49:23] ldnunes: has joined #ruby
[11:49:23] hahuang65: has joined #ruby
[11:50:40] bigblind: has joined #ruby
[11:58:01] Psybur: has joined #ruby
[11:58:01] Psybur: has joined #ruby
[11:59:40] suukim: has joined #ruby
[12:04:16] leitz: Is there any need for a gem/module to build a book from text files, or has it been done to death and I just missed it? https://github.com/makhidkarun/rb_tools/blob/master/bin/build_book
[12:04:22] hahuang65: has joined #ruby
[12:04:22] ferr1: has joined #ruby
[12:06:07] Papierkorb: has left #ruby: ("Konversation terminated!")
[12:11:33] tbuehlmann: dminuoso: eventually a service becomes a lambda, yep
[12:13:36] drewmcmillan: has joined #ruby
[12:14:26] sidx64: has joined #ruby
[12:16:59] ferr1: has left #ruby: ("WeeChat 2.0.1")
[12:18:29] leitz: Hmm..I thought methods had access to variables defined in an outer scope, assuming the method didn't declare its own variable with the same name.
[12:19:01] wojnar: has joined #ruby
[12:19:29] hahuang65: has joined #ruby
[12:20:06] darix: leitz: no
[12:20:09] darix: why would they?
[12:20:35] leitz: darix, so you didn't have to redefine dozens of variables used by multiple methods?
[12:21:55] apeiros: leitz: that's what you use object state for, via @instance_variables
[12:22:36] leitz: Doesn't seem like a good object candidate though.
[12:22:53] apeiros: don't know what "it" is, so can't comment on that.
[12:23:26] apeiros: but if you have dozens of variables which are all accessed by multiple methods, then there are certainly one to many candidates for classes in there.
[12:23:51] leitz: apeiros, sorry. Coffee still kicking in. I'm taking text files and combining them into a book. Variables include the book's file name, the scene file names, directory names, etc.
[12:24:17] leitz: apeiros, the current code is here: https://github.com/makhidkarun/rb_tools/blob/master/bin/build_book
[12:24:34] apeiros: that sounds like a complex task and so naturally will have a couple of classes
[12:24:56] dostoyevsky: Does anyone know a project that uses antlr for ruby? I want to see how I can access the parsed data after calling my Parser.new("string") ... documentation seems very sparse
[12:24:57] leitz: Each scene gets written to a chapter file, and appended to the book.
[12:25:12] dminuoso: tbuehlmann: The problem is thats not what most services ive seen model. And if they do, then stop calling it a "service" because thats just Javaism trying to make every simple concept some weird pattern.
[12:25:26] dminuoso: tbuehlmann: It's kind of hilarious what dependency injection becomes in a functionally oriented setting.
[12:25:34] dminuoso: It's just "arguments" :P
[12:26:43] apeiros: isn't DI just a fancy term for "I want to rely on an argument instead of (potentially global) state"?
[12:27:09] apeiros: leitz: yes, that code certainly lends itself to have a class or two
[12:28:27] Ryzokuken: has joined #ruby
[12:28:52] jenrzzz: has joined #ruby
[12:28:52] jenrzzz: has joined #ruby
[12:30:02] DaveTaboola: has joined #ruby
[12:30:39] schneider-: has joined #ruby
[12:31:46] sidx64: has joined #ruby
[12:31:46] leitz: apeiros, such as? Remember, I'm the OOP newbie. :)
[12:32:55] apeiros: the cheap thing is to start with a BookBuilder class
[12:33:04] dminuoso: apeiros: Yup. Haskell aside (I just happen to come across a lot of Haskell related topics), the core inside this is very useful: https://stackoverflow.com/a/14329487
[12:33:19] dminuoso: apeiros: And it largely can be applied to Ruby too. But the essential part is: Let's solve the real problem. Keep in mind that you are solving a problem, and that problem is the particular programming task at hand. Don't make your problem "implementing dependency injection".
[12:34:02] apeiros: dminuoso: I'm just continuously amazed at how people manage to even come up with whole DI frameworks
[12:34:22] hahuang65: has joined #ruby
[12:34:23] dminuoso: apeiros: +1
[12:35:26] apeiros: `Don't make your problem "implementing dependency injection"` is part of a larger pattern I've noticed years ago: puzzle coders
[12:35:37] apeiros: "I have this pattern, how can I fit this into my problem?"
[12:36:22] apeiros: instead of "this is my problem, how do I solve this?" and then "Ah, my solution matches the description of pattern X, so I'll tell my coworkers I solved it using pattern X" (as in: use pattern for communication, not for problem identification & solving)
[12:36:30] leitz: apeiros, I need to think through the class idea. I'm not against a small number of classes, if that pattern fits my problem. However, I'm not sure what problem the class(es) would solve outside passing variables.
[12:37:00] apeiros: leitz: why does it have to solve more problems than "outside passing variables"?
[12:37:16] leitz: apeiros, I can solve that with a hash.
[12:37:17] apeiros: sounds a bit like "why would I need money, other than to buy things?"
[12:37:36] apeiros: leitz: yes. in a worse way.
[12:37:45] apeiros: you can also solve it by using globals.
[12:37:51] apeiros: and that too is worse.
[12:37:54] leitz: Classes are easy, if you understand them well. I assume, haven't gotten there yet.
[12:37:56] dminuoso: apeiros: Another interesting part, is that a lot of patterns in languages emerge because of missing language tools to model some abstraction. DI is done frequently because first class support for currying functions or monads is lacking in most languages.
[12:38:04] leitz: ACTION even avoids globals.
[12:38:08] apeiros: leitz: high time to get started then :-p
[12:38:29] dminuoso: apeiros: So you try to shoehorn some ability into a language and then call it a "pattern", put it into GoF and people will mindlessly copy it.
[12:38:51] dminuoso: I kind of detest GoF because of the impact the book has had
[12:38:55] leitz: ACTION ensures his copy of GoF isn't too visible on the shelf.
[12:39:09] hahuang61: has joined #ruby
[12:39:30] apeiros: leitz: and I think part of your problem to get used to classes is that you seem to think "but it must help me solve a complex problem!" - no, it doesn't. it's already something if it helps you solve your "I need to access this state" problem.
[12:40:18] dminuoso: leitz: I personally have started to make heavy usage of lambdas and currying in Ruby.
[12:40:26] dminuoso: Simply because I dont need the deep and complex meaning of objects with internal state.
[12:40:34] dostoyevsky: leitz: Are you using a SingletonFactoryForestRunForest to guard the book's visibility?
[12:40:43] leitz: dminuoso, I thought you didn't like lambdas?
[12:40:58] dminuoso: leitz: Ruby lambdas are the cleanest first class functions.
[12:41:04] dminuoso: leitz: Its procs and blocks that have annoying semantics.
[12:41:12] dminuoso: Here's why:
[12:41:16] leitz: dostoyevsky, no classes at all. Yet. apeiros and dminuoso will probably convince me to change that.
[12:41:20] dminuoso: >> -> e { e }[1,2]
[12:41:22] ruby[bot]: dminuoso: # => wrong number of arguments (given 2, expected 1) (ArgumentError) ...check link for more (https://eval.in/967423)
[12:43:22] apeiros: has joined #ruby
[12:43:32] dminuoso: apeiros: Swiss quality internet!
[12:43:42] dminuoso: ACTION grins
[12:44:34] apeiros: dminuoso: no, apple being stupid. tethered via my iphone through BT. plugging the iphone via lightning caused the tethering to reconnect.
[12:45:34] apeiros: I could connect through company wifi too. but private laptop requires reauthorization daily through an arduous process. and ever since I've flatrate internet on my mobile, that's just the easier way.
[12:45:39] bigblind: has joined #ruby
[12:45:48] apeiros: additionally no potential corporate spying on my internet activity :-D
[12:46:56] sidx64: has joined #ruby
[12:47:08] dminuoso: leitz: So for example everytime you hear "Builder", you can actually just write a simple lambda.
[12:47:25] dminuoso: A "builder" is just something that "produces some results"
[12:47:32] apeiros: dminuoso: I think you're preparing leitz for something they'll encounter in maybe 2 or 3 years
[12:49:44] leitz: dminuoso, I have read most of "Mastering Ruby Closures" to get a better understanding of procs and lambas. I know more, but considering how little I knew that's not saying much.
[12:49:57] dminuoso: leitz: Do you know what a method is?
[12:50:21] leitz: I also promised to get the book out in the next couple weeks, so major refactoring will have to wait just a bit.
[12:50:25] dminuoso: leitz: Now remove "self", and conceptually you end up with a lambda.
[12:50:39] dminuoso: a lambda is just a function you can call, that produces some result.
[12:50:46] leitz: dminuoso, Ruby "assumes" self, correct?
[12:51:02] dminuoso: leitz: well, my point is methods are tied to objects
[12:51:03] dminuoso: lambdas are not
[12:51:11] apeiros: leitz: any method call without an explicit receiver is sent to self, yes
[12:51:25] apeiros: assuming that's what you mean by "assuming self"
[12:51:43] hahuang65: has joined #ruby
[12:51:44] leitz: apeiros, yes. Like Python's self being explicit, I believe.
[12:52:06] dminuoso: leitz: Consider this: `m = -> e { puts e }` and `def m e; puts e; end`
[12:52:10] dminuoso: leitz: They kind of look the same right?
[12:52:24] dminuoso: neither is tied to some internal objects state
[12:52:38] leitz: Sorry if i seem like the dense kid in the back of the class. I'm actually the dense old guy in the front trying to re-learn.
[12:52:56] leitz: dminuoso, yes, absent " ->"
[12:53:05] dminuoso: leitz: that's just syntax, like def.
[12:53:12] dminuoso: leitz: -> is the "def" for lambdas :)
[12:53:29] leitz: ACTION gets his notepad and starts noting.
[12:53:43] AJA4350: has joined #ruby
[12:53:54] dminuoso: leitz: https://eval.in/967426
[12:54:21] sidx64: has joined #ruby
[12:54:22] dminuoso: leitz: There really isn't much do it. `func` is not basically a function. The cool thing is, you can pass `func` around.
[12:54:29] dminuoso: *func is basically
[12:55:28] dminuoso: https://eval.in/967430
[12:56:03] leitz: That's part of what I didn't see before reading the book; why not use a method vice proc/lambda? Still letting that sink in and looking for use cases.
[12:56:26] dminuoso: leitz: consider the opposite rather. why use a method?
[12:56:42] dminuoso: leitz: iow: what makes a method different from my `func` and `add`
[12:57:34] leitz: dminuoso, the familiarity of "def" and her cousins in other languages.
[12:57:57] leitz: Sort of like match and ~
[12:59:11] dminuoso: leitz: Methods have to reside in classes (always), which means they are tied to objects of that class. If
[12:59:44] dminuoso: So you have to have an object of that class around to invoke that method. If you want to invoke it "without a receiver", you actually make it a completely global method. There's very little in between
[13:00:04] dminuoso: a lambda lets you encapsulate the idea of some computation into a small local object that you can pass around.
[13:01:27] melodia[m]: has left #ruby: ("User left")
[13:01:28] leitz: dminuoso, not sure I get the "Methods have to reside in classes". I use "def ..." outside of classes in my regular code.
[13:02:07] apeiros: leitz: method(:your_method).owner will tell you where those end up
[13:02:24] Beams: has joined #ruby
[13:02:29] dminuoso: leitz: Even then they still end up in a class.
[13:02:45] dminuoso: leitz: And you cant (trivially) pass around a method itself as a value
[13:03:05] apeiros: I'd like to challenge that :)
[13:03:25] dminuoso: apeiros: UnboundMethods have that problem you still need a value, and a :symbol is too lax
[13:03:30] apeiros: both, Object#method and symbols are trivial
[13:03:45] dminuoso: apeiros: For both you still need an object to make it meaningful
[13:04:02] apeiros: yes. it's still trivial.
[13:05:04] schneider-: has joined #ruby
[13:05:08] dminuoso: leitz: Let me phrase it differently.
[13:05:13] dminuoso: leitz: Have you ever consciously used a block?
[13:05:46] leitz: dminuoso, "used well", or just "used"? :P
[13:05:51] dminuoso: leitz: used.
[13:05:56] leitz: Then yes.
[13:06:01] dminuoso: leitz: Do you see the value in blocks?
[13:06:19] dminuoso: leitz: lambdas are blocks.
[13:06:36] dminuoso: (For the sake of this discussion this is close enough to the truth)
[13:06:37] leitz: Still working on multiple files open in the same block, and automatic closure.
[13:06:47] hahuang65: has joined #ruby
[13:06:56] jenrzzz: has joined #ruby
[13:06:56] jenrzzz: has joined #ruby
[13:06:58] alfiemax: has joined #ruby
[13:07:04] dminuoso: leitz: `-> e { ... }` and `{ |e| ... }` are two different syntaxes for the same thing.
[13:07:27] synthroid: has joined #ruby
[13:07:44] tbuehlmann: dminuoso: I have a lot of command objects in my recent project, although they are placed in app/services, but well, that's just naming. and I find them helpful as in they are encapsulated pretty well and have a reasonable purpose. also, I don't clutter controllers and keep models free of method that do too much. so that's my take on it
[13:08:09] dminuoso: leitz: and that's also the same thing as: do |e| ... end
[13:08:56] adlerdias: has joined #ruby
[13:09:24] dminuoso: leitz: let me show you the use
[13:11:57] bmurt: has joined #ruby
[13:12:38] stairmast0r: has joined #ruby
[13:15:59] hahuang61: has joined #ruby
[13:16:27] DaniG2k: has joined #ruby
[13:17:18] karapetyan: has joined #ruby
[13:18:10] dminuoso: leitz: https://gist.github.com/dminuoso/198d794f2b4f6bfdf63a0ec0615d6f59
[13:19:11] leitz: ACTION goes to read.
[13:19:55] dminuoso: leitz: Everytime you pass a block, you actually pass a *function* as an additional parameter. An anoymous function.
[13:20:03] dminuoso: It has no name, but it takes arguments and returns things
[13:20:28] dminuoso: It just looks a bit quirky because it doesn't look like a parameter since its not inside the () parens of the method call. But that's just the syntax being funky.
[13:21:52] hahuang65: has joined #ruby
[13:23:04] armyriad: has joined #ruby
[13:24:05] leitz: Okay, taking this slowly.
[13:25:37] leitz: The first line of ex.md assuming File.open has a "block_given" set of code, correct? If no block given you can foo = File.open("foo.csv", "w"), correct?
[13:25:56] dminuoso: leitz: Yup, which it does =)
[13:26:08] dminuoso: leitz: But you can change this to _any_ other method that works with a block.
[13:26:15] dminuoso: Array#map is particularly interesting
[13:26:34] dminuoso: >> square = -> e { e * e }; puts square[4]
[13:26:35] ruby[bot]: dminuoso: # => 16 ...check link for more (https://eval.in/967450)
[13:26:43] Ryzokuken: has joined #ruby
[13:26:51] dminuoso: >> square = -> e { e * e }; [1,2,3,4,5].map(&square)
[13:26:52] ruby[bot]: dminuoso: # => [1, 4, 9, 16, 25] (https://eval.in/967451)
[13:27:28] leitz: ACTION is still getting used to the & thing.
[13:27:38] dminuoso: leitz: just ignore it silently for now.
[13:27:48] dminuoso: leitz: For the purpose of this discussion you can pretend its not there.
[13:27:58] dminuoso: leitz: I'd argue its actually a mistake from the Ruby authors to not allow it without an ampersand.
[13:27:59] ldnunes: has joined #ruby
[13:28:04] leitz: Brain locks up trying to derefence the pointer. :)
[13:28:27] dminuoso: leitz: For the purpose of reasoning about this, ignore the ampersand.
[13:33:07] \du: has joined #ruby
[13:33:10] \du: Hello, I want to get a string from a key in an array of hashes, there is any built-in function for it or should I iterate over the array? all the logic will happen in a .erb template, better here: https://kopy.io/QKLGa#Aj9Kphh1UKqFKk any clue? Thanks
[13:33:54] leitz: dminuoso, the first line in ex.md is similar to this, correct? https://github.com/makhidkarun/rb_tools/blob/master/bin/build_book#L69-L73
[13:34:45] dminuoso: leitz: That { |f| .... } part
[13:34:51] dminuoso: leitz: Is basically a function defined inline.
[13:35:05] leitz: The "handler"
[13:35:07] dminuoso: You just never assign it to a variable, you just pass that function along to Fileopen
[13:35:11] dminuoso: leitz: Yeah.
[13:36:45] hahuang65: has joined #ruby
[13:37:39] dminuoso: \du: Just `map` to map each element to the respective URL, and then join them together.
[13:38:36] sauvin: has joined #ruby
[13:38:57] milardovich: has joined #ruby
[13:39:10] leitz: dminuoso, the handler can use variables defined in the outer scope, correct? I think that's what I understood from the book. If so then I can use that to clean up the code a bit.
[13:39:36] dminuoso: leitz: Yeah.
[13:39:57] dminuoso: leitz: That part (the ability to use things from outside the function definition) is why you call it a closure.
[13:40:00] bigblind: has joined #ruby
[13:40:09] dminuoso: leitz: But at the core `handler` is just a function
[13:40:12] dminuoso: not unlike:
[13:40:17] dminuoso: square = -> e { e * e }
[13:41:29] cgfbee: has joined #ruby
[13:41:45] leitz: Okay, I need to let this soak in and re-read that section of the book. My boss might appreciate some time on work tasks as well. :)
[13:41:52] leitz: This is cool.
[13:42:08] \du: dminuoso: Thanks for the tip, I will try. It is for a Chef recipe, not a ruby expert :-/
[13:42:27] Ryzokuken: has joined #ruby
[13:42:45] dminuoso: \du: a = {'locale' => 'en','url' => 'weben.net'}
[13:42:50] dminuoso: \du: How do you get `weben.net` ?
[13:44:56] \du: dminuoso: I use this array of hashes in other place doing a <% @domains.each do |domain| %> ... <%= domain['url'] %>..
[13:45:06] ivanc: has joined #ruby
[13:45:18] \du: but now I want to generate a regexpr to be used in one http server directive
[13:48:48] jenrzzz: has joined #ruby
[13:49:38] jcalla: has joined #ruby
[13:50:31] k0mpa: has joined #ruby
[13:51:49] hahuang65: has joined #ruby
[13:52:18] dminuoso: \du: Right. So you can use the same idea for `map` :)
[13:52:34] RougeR: has joined #ruby
[13:52:35] RougeR: has joined #ruby
[13:52:36] dminuoso: \du: i.e. hash.map { |d| d['url'] }.join('|')
[13:52:42] \du: foo.map { |domain| domain['url'] }.join('|')
[13:52:47] \du: dminuoso: just got it, thanks!
[13:52:53] dminuoso: Even better.
[13:53:15] ams__: has joined #ruby
[13:56:31] Beams: has joined #ruby
[13:58:32] mtkd: has joined #ruby
[14:01:31] konos5__: has joined #ruby
[14:01:42] schneider-: has joined #ruby
[14:06:56] hahuang65: has joined #ruby
[14:14:59] bmurt_: has joined #ruby
[14:15:14] milardovich: has joined #ruby
[14:15:23] Ryzokuken: has joined #ruby
[14:21:46] hahuang65: has joined #ruby
[14:23:35] workmad3: has joined #ruby
[14:24:21] alex``: has joined #ruby
[14:25:50] burgestrand: has joined #ruby
[14:26:32] redondos: has joined #ruby
[14:26:32] redondos: has joined #ruby
[14:27:27] schneider-: has joined #ruby
[14:32:44] jenrzzz: has joined #ruby
[14:32:45] jenrzzz: has joined #ruby
[14:36:45] hahuang65: has joined #ruby
[14:40:51] IanMalcolm: has joined #ruby
[14:40:51] DLSteve_: has joined #ruby
[14:41:11] hahuang61: has joined #ruby
[14:41:39] ramfjord: has joined #ruby
[14:42:27] tomphp: has joined #ruby
[14:43:59] DTZUZO: has joined #ruby
[14:44:49] synthroid: has joined #ruby
[14:46:07] nicesignal: has joined #ruby
[14:50:11] bigblind: has joined #ruby
[14:51:51] hahuang65: has joined #ruby
[14:59:22] pastorinni: has joined #ruby
[15:01:17] spiette: has joined #ruby
[15:03:46] suhdood: has joined #ruby
[15:04:54] joe_from_maine: has joined #ruby
[15:04:55] gnufied: has joined #ruby
[15:06:21] [Butch]: has joined #ruby
[15:06:32] papajo: has joined #ruby
[15:06:50] hahuang65: has joined #ruby
[15:08:48] cadillac_: has joined #ruby
[15:11:36] Rapture: has joined #ruby
[15:13:11] bigblind: has joined #ruby
[15:13:14] jenrzzz: has joined #ruby
[15:21:45] hahuang65: has joined #ruby
[15:28:04] milardovich: has joined #ruby
[15:29:40] Zaab1t: has joined #ruby
[15:31:07] fribmendes: has joined #ruby
[15:32:02] d10n-work: has joined #ruby
[15:32:36] morfin: has joined #ruby
[15:33:05] DaniG2k: has joined #ruby
[15:33:21] icedragon: has joined #ruby
[15:36:46] hahuang65: has joined #ruby
[15:36:52] Ryzokuken: has joined #ruby
[15:38:04] howdoi: has joined #ruby
[15:38:26] logoscoder: has joined #ruby
[15:39:55] toks: has joined #ruby
[15:40:25] hahuang61: has joined #ruby
[15:47:40] netherwolfe: has joined #ruby
[15:49:17] jenrzzz: has joined #ruby
[15:49:17] jenrzzz: has joined #ruby
[15:49:21] tomphp: has joined #ruby
[15:51:47] hahuang65: has joined #ruby
[15:54:13] cschneid: has joined #ruby
[16:01:35] fribmendes: has joined #ruby
[16:04:09] amatas: has joined #ruby
[16:04:14] Zaab1t: has joined #ruby
[16:05:29] gnulnx: has joined #ruby
[16:06:52] hahuang65: has joined #ruby
[16:07:48] karapetyan: has joined #ruby
[16:09:32] Derperpe-: has left #ruby: ("WeeChat 2.0")
[16:09:38] oleo: has joined #ruby
[16:20:53] troys: has joined #ruby
[16:21:49] hahuang65: has joined #ruby
[16:26:05] jenrzzz: has joined #ruby
[16:26:05] jenrzzz: has joined #ruby
[16:29:30] StarSeed0000: has joined #ruby
[16:30:17] apeiros: has joined #ruby
[16:34:04] goatish: has joined #ruby
[16:35:32] raynold: has joined #ruby
[16:36:51] hahuang65: has joined #ruby
[16:38:06] cagomez: has joined #ruby
[16:39:20] hahuang61: has joined #ruby
[16:39:40] brewops: has joined #ruby
[16:39:47] cagomez: has joined #ruby
[16:40:24] milardovich: has joined #ruby
[16:40:25] brewops: Does anyone know if there is a puma specific channel anywhere?
[16:42:51] trautwein: has joined #ruby
[16:43:05] ErhardtMundt: has joined #ruby
[16:43:55] marens: has joined #ruby
[16:43:56] marens: has joined #ruby
[16:45:42] mtkd: has joined #ruby
[16:46:06] errakeshpd: has joined #ruby
[16:47:25] mjolnird: has joined #ruby
[16:47:58] hahuang65: has joined #ruby
[16:49:42] jcarl43: has joined #ruby
[16:49:46] mrBen2k2k2k_: has joined #ruby
[16:55:35] [Butch]: has joined #ruby
[16:55:45] dionysus69: has joined #ruby
[16:56:50] eckhardt: has joined #ruby
[16:57:12] jeffreylevesque: has joined #ruby
[17:00:37] bmurt: has joined #ruby
[17:01:46] gr33n7007h: has joined #ruby
[17:04:23] suukim: has joined #ruby
[17:04:58] jenrzzz: has joined #ruby
[17:06:46] hahuang65: has joined #ruby
[17:11:27] zacts: has joined #ruby
[17:12:48] darix: brewops: dont think so
[17:13:56] brewops: Running into an issue with Puma itself thats not really rails related, so I suppose I could post here too in case anyone has ideas
[17:14:13] anjen: has joined #ruby
[17:19:07] \void: has joined #ruby
[17:19:46] John_Ivan: has joined #ruby
[17:19:47] John_Ivan: has joined #ruby
[17:20:18] synthroid: has joined #ruby
[17:21:16] havenwood: brewops: This is a good channel to ask in.
[17:22:11] brewops: Sounds good, here it is!
[17:22:13] brewops: We are using Puma with our Rails apps and ran into a fun scenario. We pack everything together including Ruby and all Gems and deploy it as an artifact. When we restart (reload) Puma, since Ruby was packed with the release the master process holds onto old files in the last release. Any idea how we could do something more like Unicorn reloads so the master process would let go of these files?
[17:32:44] darix: brewops: you mean the seamless restart mode from unicorn right?
[17:32:51] darix: where it hands down the listen socket?
[17:33:51] brewops: Yea, the unicorn reload starts new worker processes and finally the master resulting in a new master PID.
[17:33:56] havenwood: https://github.com/puma/puma/blob/master/docs/restart.md
[17:34:30] brewops: With Puma, the master process is not restarted/reloaded or started new so it holds on Ruby files from the old release no matter the reload/restart method
[17:35:03] brewops: The only way to get Puma to switch over to using the new Ruby contained in the newest deployed artifact is a stop/start
[17:35:03] darix: readme.md mentions socket passing
[17:35:06] brewops: so far as I can see
[17:35:11] jerikl: has joined #ruby
[17:35:13] darix: but maybe it still holds onto the code
[17:35:29] brewops: Yea, the workers all do the right thing and end up running the new code
[17:35:52] brewops: So we didn't actually notice until we went poking around with lsof
[17:36:49] hahuang65: has joined #ruby
[17:37:58] darix: i would ask in a github issue
[17:38:17] brewops: Not a bad idea, I'll give that a try
[17:38:24] brewops: Was hoping I was missing something :)
[17:40:49] darkhanb: has joined #ruby
[17:41:55] suhdood: has joined #ruby
[17:42:36] jenrzzz: has joined #ruby
[17:42:36] jenrzzz: has joined #ruby
[17:45:42] nowhere_man: has joined #ruby
[17:46:07] dmitriy_: has joined #ruby
[17:50:29] synthroid: has joined #ruby
[17:51:42] hahuang65: has joined #ruby
[17:52:19] sanscoeur: has joined #ruby
[17:56:09] synthroid: has joined #ruby
[17:56:49] karapetyan: has joined #ruby
[17:56:50] claudiuinberlin: has joined #ruby
[17:58:19] conta: has joined #ruby
[18:00:34] Success: has joined #ruby
[18:00:35] hahuang61: has joined #ruby
[18:00:46] Success: omg i just saw the new ruby
[18:01:13] orbyt_: has joined #ruby
[18:01:19] Success: how easy is it to compile ruby on windows from source
[18:02:20] gnufied: has joined #ruby
[18:02:46] dmitriy_: has joined #ruby
[18:04:01] Success: has joined #ruby
[18:06:21] mcr1: has joined #ruby
[18:06:45] hahuang65: has joined #ruby
[18:07:46] dmitriy_: has joined #ruby
[18:12:41] Lytol: has joined #ruby
[18:12:48] dmitriy_: has joined #ruby
[18:13:43] Zaab1t: has joined #ruby
[18:16:05] sammi`_: has joined #ruby
[18:17:50] dmitriy_: has joined #ruby
[18:18:45] jenrzzz: has joined #ruby
[18:18:45] jenrzzz: has joined #ruby
[18:20:43] ryzokuken13: has joined #ruby
[18:21:48] hahuang65: has joined #ruby
[18:22:48] dmitriy_: has joined #ruby
[18:25:21] schneider-: has joined #ruby
[18:25:39] goatish: has joined #ruby
[18:25:47] alfiemax: has joined #ruby
[18:26:21] aufi: has joined #ruby
[18:27:50] dmitriy_: has joined #ruby
[18:30:09] tAn: has joined #ruby
[18:32:54] dmitriy_: has joined #ruby
[18:36:02] balo: has joined #ruby
[18:36:42] hahuang65: has joined #ruby
[18:36:48] Gnut: has joined #ruby
[18:36:57] balo: has joined #ruby
[18:37:01] karapetyan: has joined #ruby
[18:37:47] nfk: has joined #ruby
[18:37:53] dmitriy_: has joined #ruby
[18:38:00] Gnut: If I have a static class method `self.create()`, what's the best way to reference the class if I'm looking to instantiate an instance e.g. `Classname.new()`?
[18:38:16] Gnut: Maybe self.new()?
[18:38:24] SeepingN: has joined #ruby
[18:39:36] SegFaultAX: has joined #ruby
[18:40:12] mzo: has joined #ruby
[18:40:30] PaulCapestany: has joined #ruby
[18:40:42] apeiros: Gnut: just new()
[18:40:56] apeiros: if you insist on an explicit receiver, then self.new, yes
[18:41:18] sameerynho: has joined #ruby
[18:41:18] discopatrick: has joined #ruby
[18:41:59] shoogz: has joined #ruby
[18:42:34] Gnut: apeiros: Cool, `new()` it is
[18:42:52] dmitriy_: has joined #ruby
[18:43:11] ramfjord: has joined #ruby
[18:43:21] shoogz: has joined #ruby
[18:44:36] alfiemax: has joined #ruby
[18:45:27] ryzokuken13: has joined #ruby
[18:47:49] dmitriy_: has joined #ruby
[18:51:49] hahuang65: has joined #ruby
[18:51:54] nowhereman_: has joined #ruby
[18:52:49] dmitriy_: has joined #ruby
[18:53:09] aufi: has joined #ruby
[18:55:52] dionysus69: has joined #ruby
[18:57:49] dmitriy_: has joined #ruby
[19:01:41] netherwolfe: has joined #ruby
[19:02:52] tomphp: has joined #ruby
[19:02:53] dmitriy_: has joined #ruby
[19:06:22] gnufied: has joined #ruby
[19:07:50] Ryzokuken: has joined #ruby
[19:09:21] mtkd: has joined #ruby
[19:12:49] eckhardt_: has joined #ruby
[19:13:34] chouhoul_: has joined #ruby
[19:14:52] chouhoul_: has joined #ruby
[19:16:17] jottr: has joined #ruby
[19:16:36] n0m4d1c: has joined #ruby
[19:21:40] Success: has joined #ruby
[19:21:43] hahuang65: has joined #ruby
[19:23:07] gnufied: has joined #ruby
[19:25:37] alfiemax: has joined #ruby
[19:27:50] alex``: has joined #ruby
[19:33:20] Dimik: has joined #ruby
[19:33:32] jenrzzz: has joined #ruby
[19:33:32] jenrzzz: has joined #ruby
[19:33:51] roshanavand: has joined #ruby
[19:36:45] hahuang65: has joined #ruby
[19:37:04] larcara: has joined #ruby
[19:37:51] tAn: has joined #ruby
[19:39:11] knight33_: has joined #ruby
[19:42:15] HashNuke: has joined #ruby
[19:42:21] Brak____________: has joined #ruby
[19:42:24] fury: has joined #ruby
[19:42:34] Chew: has joined #ruby
[19:42:47] alfiemax: has joined #ruby
[19:43:24] SeepingN_: has joined #ruby
[19:45:01] claudiuinberlin: has joined #ruby
[19:47:49] habs: has joined #ruby
[19:49:35] marr: has joined #ruby
[19:49:50] habs: hi -- i'm new to ruby, and i see some ruby code that says for example "def foo \n return @foo if defined?(@foo) \n" ... and then goes on to actually implement the function foo. what is the purpose of this statement, why have the "return if defined" line there?
[19:49:59] cstrahan: has joined #ruby
[19:51:04] apeiros: habs: looks like a (bad) memoization technique
[19:51:25] apeiros: i.e. the method will calculate an expensive value once, store it in @foo, and upon further calls just immediately return that value.
[19:51:52] hahuang65: has joined #ruby
[19:55:22] roshanavand: has joined #ruby
[19:55:34] habs: apeiros: ah thanks, yes after looking that up i can see it's definitely memoization. it's used by gitlab, what would be a better way of doing memoization? via a gem?
[19:56:09] mtkd: has joined #ruby
[19:56:15] apeiros: for starters, I prefer to use @_foo to indicate that the ivar is not to be used directly
[19:56:44] apeiros: then, if the value can't be nil or false, simply: @_foo ||= begin; …calc…; value; end
[19:57:37] apeiros: if the value can be nil/false, have a second variable to track the state. initialized with false. `if @foo_computed; @_foo; else; @_foo = …; end`
[19:57:56] apeiros: oh, forgot to set @foo_computed = true :)
[19:58:24] apeiros: if you need the whole thing in a threaded env, I'd probably resort to a gem (hoping there is one doing that correctly)
[19:59:26] alfiemax: has joined #ruby
[20:03:06] leah2: has joined #ruby
[20:03:18] jerikl: has joined #ruby
[20:06:45] hahuang65: has joined #ruby
[20:09:03] jenrzzz: has joined #ruby
[20:09:03] jenrzzz: has joined #ruby
[20:10:07] bmurt: has joined #ruby
[20:11:36] dmitriy_: has joined #ruby
[20:14:38] janos: has joined #ruby
[20:16:33] alfiemax: has joined #ruby
[20:20:54] dionysus69: has joined #ruby
[20:21:49] hahuang65: has joined #ruby
[20:23:51] cschneid: has joined #ruby
[20:23:52] alex``: has joined #ruby
[20:24:12] cschneid: has joined #ruby
[20:25:18] stairmast0r: has joined #ruby
[20:26:30] orbyt_: has joined #ruby
[20:26:47] dmitriy_: has joined #ruby
[20:29:20] mcr1: has joined #ruby
[20:30:12] Success: has joined #ruby
[20:31:48] dmitriy_: has joined #ruby
[20:34:13] zapata: has joined #ruby
[20:36:20] yqt: has joined #ruby
[20:36:49] dmitriy_: has joined #ruby
[20:36:50] hahuang65: has joined #ruby
[20:38:15] cagomez: has joined #ruby
[20:38:36] Cavallari: has joined #ruby
[20:39:03] fribmendes: has joined #ruby
[20:41:46] dmitriy_: has joined #ruby
[20:46:49] dmitriy_: has joined #ruby
[20:47:32] jenrzzz: has joined #ruby
[20:47:32] jenrzzz: has joined #ruby
[20:47:56] milardovich: has joined #ruby
[20:50:06] jrabe: has joined #ruby
[20:50:14] dtzuzu: has joined #ruby
[20:51:44] dmitriy_: has joined #ruby
[20:51:48] hahuang65: has joined #ruby
[20:52:33] xcyclist: has joined #ruby
[20:53:19] jottr: has joined #ruby
[20:53:28] cagomez: has joined #ruby
[20:54:00] kies: has joined #ruby
[20:54:36] alfiemax: has joined #ruby
[20:56:46] dmitriy_: has joined #ruby
[20:57:59] tomphp: has joined #ruby
[21:00:16] aufi: has joined #ruby
[21:06:32] eckhardt: has joined #ruby
[21:06:50] hahuang65: has joined #ruby
[21:06:56] jerikl: has joined #ruby
[21:07:59] alfiemax: has joined #ruby
[21:09:17] cagomez: has joined #ruby
[21:09:25] Azure|dc: has joined #ruby
[21:10:19] dmitriy_: has joined #ruby
[21:10:50] workmad3: has joined #ruby
[21:13:29] druonysus: has joined #ruby
[21:13:29] druonysus: has joined #ruby
[21:14:52] cjohnson: Is there any tooling or migration guides for upgrading 2.2 -> 2.4?
[21:15:02] cjohnson: And is it generally necessary to also upgrade rails from 4 -> 5 when doing so?
[21:15:16] dmitriy_: has joined #ruby
[21:15:39] darix: cjohnson: 1. not sure you need many changes for 2.2 -> 2.4 at all 2. rails 4 is EOL if i recall correctly, or will be soon. so you want to consider upgrading.
[21:15:45] s3nd1v0g1us: has joined #ruby
[21:16:00] darix: cjohnson: support for ruby 2.2 might depend on your distro. but keep in mind 2.5 is out.
[21:16:09] Yzguy: has joined #ruby
[21:16:25] cjohnson: That much is beyond scope for me, I'm one guy in one dept across many depts and we are moving to 2.4
[21:16:30] cjohnson: so it's up to us to make our apps run on 2.4
[21:16:43] cjohnson: I'm getting at least this error after upgrading to 2.4: constant ::Fixnum is deprecated
[21:16:53] cjohnson: from ActiveSupport
[21:17:08] n008f4g_: has joined #ruby
[21:17:13] darix: but that is a warning if i recall correctly :)
[21:18:31] cjohnson: Hrm, it says it's a warning, but that's the error given in this stacktrace around why passenger isn't starting
[21:18:36] cjohnson: So, a little confusing
[21:19:46] darix: cjohnson: well on which rails 4 version are you?
[21:20:20] dmitriy_: has joined #ruby
[21:20:37] cjohnson: We are tasked to upgrade apps to work on ruby 2.4, and if necessary, also upgrade to rails 5, but if it's a massive effort (20 apps or so), we may have to break it into chunks, unless upgrading ruby requires upgrading rails
[21:20:44] darix: cjohnson: http://weblog.rubyonrails.org/2017/9/27/Rails-4-2-10-released/
[21:20:50] cjohnson: It doesn't make sense to upgrade rails to an intermediate version though
[21:21:01] cjohnson: If it's necessary to bump rails at all we will stop to do 5
[21:21:20] cjohnson: But I might give that a temporary try to see if it has any impact, for curiousity
[21:21:31] cagomez: has joined #ruby
[21:21:32] darix: cjohnson: rails 4.2.10 is the last version and 4.2 wont see more security fixes.
[21:21:39] darix: cjohnson: rails 5.2 is in RC now
[21:21:52] hahuang65: has joined #ruby
[21:22:16] dtzuzu: has joined #ruby
[21:24:45] cjohnson: Nevermind the error is a red herring, the real error is in the logs
[21:24:49] cjohnson: missing database :)
[21:25:17] dmitriy_: has joined #ruby
[21:28:14] hahuang61: has joined #ruby
[21:30:22] dmitriy_: has joined #ruby
[21:35:23] dmitriy_: has joined #ruby
[21:36:51] hahuang65: has joined #ruby
[21:36:55] milardovich: has joined #ruby
[21:37:06] jerikl: has joined #ruby
[21:37:28] pastorinni: has joined #ruby
[21:38:30] ircer2: has joined #ruby
[21:38:38] dviola: has joined #ruby
[21:39:02] jottr: has joined #ruby
[21:39:59] s3nd1v0g1us: has joined #ruby
[21:40:14] fribmendes: has joined #ruby
[21:40:18] dmitriy_: has joined #ruby
[21:45:21] dmitriy_: has joined #ruby
[21:46:20] tcopeland: has joined #ruby
[21:46:25] alfiemax: has joined #ruby
[21:50:23] dmitriy_: has joined #ruby
[21:51:45] hahuang65: has joined #ruby
[21:52:04] jottr: has joined #ruby
[21:55:03] ledestin: has joined #ruby
[21:55:22] dmitriy_: has joined #ruby
[21:55:54] gnufied: has joined #ruby
[21:58:22] hahuang61: has joined #ruby
[21:58:39] GodFather: has joined #ruby
[22:00:22] dmitriy_: has joined #ruby
[22:01:25] mtkd: has joined #ruby
[22:01:34] jenrzzz: has joined #ruby
[22:01:34] jenrzzz: has joined #ruby
[22:03:33] hahuang65: has joined #ruby
[22:05:22] dmitriy_: has joined #ruby
[22:05:45] Mike11: has joined #ruby
[22:10:24] dmitriy_: has joined #ruby
[22:15:22] dmitriy_: has joined #ruby
[22:15:38] milardovich: has joined #ruby
[22:16:19] alfiemax: has joined #ruby
[22:17:59] AlHafoudh: has joined #ruby
[22:18:13] shadeslayer: has joined #ruby
[22:19:39] wolfshappen: has joined #ruby
[22:20:24] dmitriy_: has joined #ruby
[22:20:45] druonysus: has joined #ruby
[22:20:45] druonysus: has joined #ruby
[22:21:42] hahuang65: has joined #ruby
[22:22:15] druonysus: has joined #ruby
[22:22:15] druonysus: has joined #ruby
[22:22:59] jenrzzz: has joined #ruby
[22:22:59] jenrzzz: has joined #ruby
[22:25:26] dmitriy_: has joined #ruby
[22:25:57] cliluw: has joined #ruby
[22:26:39] milardovich: has joined #ruby
[22:29:01] alfiemax: has joined #ruby
[22:29:49] milardov_: has joined #ruby
[22:30:00] eckhardt: has joined #ruby
[22:30:22] dmitriy_: has joined #ruby
[22:32:37] kapil___: has joined #ruby
[22:33:32] vutral|kali: has joined #ruby
[22:33:32] vutral|kali: has joined #ruby
[22:34:41] suhdood: has joined #ruby
[22:34:42] Puffball: has joined #ruby
[22:35:23] dmitriy_: has joined #ruby
[22:36:48] hahuang65: has joined #ruby
[22:37:29] mtkd: has joined #ruby
[22:38:35] SeepingN_: has joined #ruby
[22:40:21] dmitriy_: has joined #ruby
[22:40:45] druonysuse: has joined #ruby
[22:40:45] druonysuse: has joined #ruby
[22:42:23] tomphp: has joined #ruby
[22:43:08] jenrzzz: has joined #ruby
[22:43:08] jenrzzz: has joined #ruby
[22:44:19] mtkd: has joined #ruby
[22:45:26] dmitriy_: has joined #ruby
[22:45:51] alfiemax: has joined #ruby
[22:47:51] hahuang65: has joined #ruby
[22:50:25] dmitriy_: has joined #ruby
[22:52:39] hahuang65: has joined #ruby
[22:54:12] cadillac_: has joined #ruby
[22:55:16] shinnya: has joined #ruby
[22:55:26] dmitriy_: has joined #ruby
[22:56:16] RougeR: has joined #ruby
[22:56:16] RougeR: has joined #ruby
[23:00:26] dmitriy_: has joined #ruby
[23:00:28] jerikl: has joined #ruby
[23:05:27] dmitriy_: has joined #ruby
[23:07:01] milardovich: has joined #ruby
[23:09:42] DLSteve_: has joined #ruby
[23:10:02] kies: has joined #ruby
[23:10:26] dmitriy_: has joined #ruby
[23:11:01] ramfjord: has joined #ruby
[23:11:28] workmad3: has joined #ruby
[23:12:22] milardovich: has joined #ruby
[23:12:27] hahuang65: has joined #ruby
[23:14:43] cagomez: has joined #ruby
[23:15:26] dmitriy_: has joined #ruby
[23:17:47] jottr: has joined #ruby
[23:20:18] alfiemax: has joined #ruby
[23:20:26] dmitriy_: has joined #ruby
[23:21:05] rf: has joined #ruby
[23:21:27] halbbalda: has joined #ruby
[23:21:32] ramfjord: has joined #ruby
[23:23:32] envex: has joined #ruby
[23:25:06] mtkd: has joined #ruby
[23:25:27] dmitriy_: has joined #ruby
[23:26:19] sanscoeur: has joined #ruby
[23:27:28] milardovich: has joined #ruby
[23:28:48] phaul: has joined #ruby
[23:29:07] cdg: has joined #ruby
[23:30:27] dmitriy_: has joined #ruby
[23:32:57] roshanavand: has joined #ruby
[23:35:33] dmitriy_: has joined #ruby
[23:37:03] eckhardt: has joined #ruby
[23:37:04] konsolebox: has joined #ruby
[23:38:39] Lara: has joined #ruby
[23:40:28] dmitriy_: has joined #ruby
[23:42:01] chouhoulis: has joined #ruby
[23:42:59] n0m4d1c: has joined #ruby
[23:45:31] dmitriy_: has joined #ruby
[23:46:10] Lara: has left #ruby: ()
[23:49:05] jenrzzz: has joined #ruby
[23:49:05] jenrzzz: has joined #ruby
[23:50:30] dmitriy_: has joined #ruby
[23:51:13] konsolebox: has joined #ruby
[23:52:55] gnufied: has joined #ruby
[23:53:20] chouhoulis: has joined #ruby
[23:55:31] dmitriy_: has joined #ruby