« Back to channel list

#ruby - 21 May 2018

« Back 1 day Forward 1 day »
[00:05:28] Guest33581: has joined #ruby
[00:06:53] ciscam: has joined #ruby
[00:08:36] VladGh: has joined #ruby
[00:09:20] jnollette: has joined #ruby
[00:09:56] parzydeuko: has joined #ruby
[00:16:50] RougeR: has joined #ruby
[00:17:32] emilford: has joined #ruby
[00:18:23] cschneid: has joined #ruby
[00:29:35] BTRE: has joined #ruby
[00:32:38] emilford: has joined #ruby
[00:37:26] minimalism: has joined #ruby
[00:39:58] Pisuke: has joined #ruby
[00:40:16] alfiemax: has joined #ruby
[00:42:08] amar: has joined #ruby
[00:44:47] rkazak: has joined #ruby
[00:46:28] Bonjourm8: has joined #ruby
[00:49:59] nowhere_man: has joined #ruby
[00:51:21] Asher: has joined #ruby
[00:57:17] noobineer: has joined #ruby
[01:00:31] karapetyan: has joined #ruby
[01:00:51] Guest777: has joined #ruby
[01:07:00] emilford: has joined #ruby
[01:12:22] gil_: has joined #ruby
[01:12:22] gil_: has joined #ruby
[01:18:27] seabee: has joined #ruby
[01:30:26] griffindy: has joined #ruby
[01:36:10] amar: has joined #ruby
[01:42:40] Ryzokuken: has joined #ruby
[01:58:02] Ryzokuken: has joined #ruby
[01:58:14] alfiemax: has joined #ruby
[01:58:32] govg: has joined #ruby
[01:59:44] cagomez: has joined #ruby
[02:05:18] cschneid: has joined #ruby
[02:05:44] white_lilies: has joined #ruby
[02:11:28] ciscam: has joined #ruby
[02:14:45] seabee: has joined #ruby
[02:15:21] nowhere_man: has joined #ruby
[02:21:49] dkphenom: has joined #ruby
[02:32:37] Ryzokuken: has joined #ruby
[02:37:43] Asher: has joined #ruby
[02:38:36] alfiemax: has joined #ruby
[02:39:20] cschneid: has joined #ruby
[02:44:49] griffindy: has joined #ruby
[02:46:21] ayosurice: has joined #ruby
[02:51:03] tdy: has joined #ruby
[02:54:54] c0ncealed1: has joined #ruby
[02:57:55] Azure: has joined #ruby
[03:00:08] cadillac_: has joined #ruby
[03:01:58] karapetyan: has joined #ruby
[03:15:45] alfiemax: has joined #ruby
[03:21:22] govg: has joined #ruby
[03:22:11] cadillac_: has joined #ruby
[03:27:24] duderonomy: has joined #ruby
[03:50:45] gix: has joined #ruby
[03:55:15] thapakazi: has joined #ruby
[03:55:28] thapakazi_: has joined #ruby
[03:58:55] alfiemax: has joined #ruby
[03:59:05] houhoulis: has joined #ruby
[04:10:59] harryv: has joined #ruby
[04:23:00] Ryzokuken: has joined #ruby
[04:23:04] ecksian: has joined #ruby
[04:29:07] ciscam: has joined #ruby
[04:46:21] conta: has joined #ruby
[04:53:01] alfiemax: has joined #ruby
[04:56:26] alfiemax_: has joined #ruby
[05:00:57] armyriad: has joined #ruby
[05:01:20] vimal2012: has joined #ruby
[05:03:20] karapetyan: has joined #ruby
[05:03:36] vimal2012: has left #ruby: ("Leaving")
[05:09:38] \void: has joined #ruby
[05:28:55] ur5us: has joined #ruby
[05:35:34] aupadhye: has joined #ruby
[05:36:09] anisha: has joined #ruby
[05:37:49] anisha: has joined #ruby
[05:48:10] TinkerT: has joined #ruby
[05:50:19] duderonomy: has joined #ruby
[05:52:59] sidx64: has joined #ruby
[06:00:28] sidx64: has joined #ruby
[06:06:58] roshanavand: has joined #ruby
[06:09:50] tuskkk___: has joined #ruby
[06:13:05] conta: has joined #ruby
[06:17:59] guacamole: has joined #ruby
[06:28:45] reber: has joined #ruby
[06:29:27] schleppel: has joined #ruby
[06:29:38] ciscam: has joined #ruby
[06:32:41] sidx64: has joined #ruby
[06:35:08] amar_: has joined #ruby
[06:43:19] alfiemax: has joined #ruby
[06:43:30] lele: has joined #ruby
[06:45:18] sidx64: has joined #ruby
[06:45:24] mtkd: has joined #ruby
[06:47:13] saltsa: has joined #ruby
[06:53:38] amar_: has joined #ruby
[06:58:40] sidx64: has joined #ruby
[07:04:45] karapetyan: has joined #ruby
[07:13:04] sidx64_: has joined #ruby
[07:13:33] sphenxes: has joined #ruby
[07:16:58] sidx64: has joined #ruby
[07:18:43] apeiros: has joined #ruby
[07:20:18] sidx64: has joined #ruby
[07:26:48] dinfuehr: has joined #ruby
[07:26:57] venmx: has joined #ruby
[07:32:09] yohji: has joined #ruby
[07:35:45] sidx64: has joined #ruby
[07:38:21] pskosinski: has joined #ruby
[07:38:33] dionysus69: has joined #ruby
[07:40:11] kapil___: has joined #ruby
[07:42:16] burgestrand: has joined #ruby
[07:48:03] rivalomega: has joined #ruby
[07:48:45] diegok: has joined #ruby
[07:50:38] apeiros: has joined #ruby
[07:51:01] Xeago_: has joined #ruby
[07:55:19] Silthias: has left #ruby: ()
[08:08:38] dionysus69: has joined #ruby
[08:11:39] apeiros: has joined #ruby
[08:13:20] Ryzokuken: has joined #ruby
[08:17:34] guille-moe: has joined #ruby
[08:17:46] dionysus69: has joined #ruby
[08:18:59] aufi: has joined #ruby
[08:20:32] suukim: has joined #ruby
[08:27:33] clemens3: has joined #ruby
[08:28:47] Guest33581: has joined #ruby
[08:30:19] amar_: has joined #ruby
[08:35:27] KeyJoo: has joined #ruby
[08:38:21] apeiros: has joined #ruby
[08:40:09] Nilium: has joined #ruby
[08:41:13] apeiros: has joined #ruby
[08:41:19] amar_: has joined #ruby
[08:44:35] sytherax_: has joined #ruby
[08:44:56] biberu: has joined #ruby
[08:46:08] Mike11: has joined #ruby
[08:51:13] Nilium: has joined #ruby
[08:54:21] Faraon_: has joined #ruby
[08:58:05] roshanavand: has joined #ruby
[09:01:36] marr: has joined #ruby
[09:06:04] karapetyan: has joined #ruby
[09:11:40] josealobato: has joined #ruby
[09:11:54] lxsameer: has joined #ruby
[09:12:55] josealobato: Does anybody have any documentation on how to use aruba for testing CLI gems?
[09:13:28] josealobato: I have set it up but I do not know the API and their documentation is terrible (IMO). Of course it is Cucumber use cases.
[09:16:15] kmurphy4: has joined #ruby
[09:16:29] arekushi: has joined #ruby
[09:20:16] ur5us: has joined #ruby
[09:21:05] Radar: josealobato: https://bundler.io/v1.16/guides/creating_gem.html this guide covers a bit of it.
[09:22:38] josealobato: Thanks Radar, I already read that. I'm trying to go with RSpec instead fo cucumber. I'm looking more about whare the the methods availabe and where and how to set the test files... stuff like that.
[09:22:54] venmx: has joined #ruby
[09:25:53] alfiemax_: has joined #ruby
[09:30:32] sytherax_: has joined #ruby
[09:31:36] dhollinger: has joined #ruby
[09:31:45] Ryzokuken: has joined #ruby
[09:32:56] sudorobo: has joined #ruby
[09:33:02] josealobato: In fact I was surprised that their only docs is the cucumber cases. For AC are great but like user documentation is not fantastic.
[09:33:37] Radar: Maybe it is that way for a reason.
[09:37:01] sidx64: has joined #ruby
[09:48:55] ARCADIVS: has joined #ruby
[09:53:41] RougeR: has joined #ruby
[09:53:41] RougeR: has joined #ruby
[09:59:26] conta: has joined #ruby
[10:02:17] parzydeuko: has joined #ruby
[10:02:19] ciscam: has joined #ruby
[10:03:15] karapetyan: has joined #ruby
[10:04:29] anisha: has joined #ruby
[10:10:26] mikecmpbll: has joined #ruby
[10:14:54] kapil___: has joined #ruby
[10:17:55] alfiemax: has joined #ruby
[10:20:37] guille-moe: has joined #ruby
[10:20:58] alfiemax: has joined #ruby
[10:25:26] clemens3: has joined #ruby
[10:25:46] plexigras: has joined #ruby
[10:30:13] jamesaxl: has joined #ruby
[10:32:21] conta: has joined #ruby
[10:34:20] getxsick: has joined #ruby
[10:36:28] AJA4350: has joined #ruby
[10:37:23] sidx64: has joined #ruby
[10:39:18] conta: has joined #ruby
[10:39:39] alfiemax_: has joined #ruby
[10:40:28] parzydeuko: has joined #ruby
[10:41:42] amatas: has joined #ruby
[10:42:52] ciscam: has joined #ruby
[10:51:10] amatas: has joined #ruby
[10:53:45] chef_byd: has joined #ruby
[10:57:05] chef_byd: has joined #ruby
[10:57:27] chef_byd: has joined #ruby
[10:57:33] josealobato: has joined #ruby
[10:58:58] conta: has joined #ruby
[10:59:07] andrewvos: has joined #ruby
[11:08:22] rawste: has joined #ruby
[11:09:48] conta: has joined #ruby
[11:10:48] jrafanie: has joined #ruby
[11:14:59] kliq: has joined #ruby
[11:17:55] Puffball: has joined #ruby
[11:19:01] sidx64: has joined #ruby
[11:20:23] cajone: has joined #ruby
[11:21:51] Mike11: has joined #ruby
[11:22:22] tAn: has joined #ruby
[11:22:47] mtkd: has joined #ruby
[11:23:41] Cavallari: has joined #ruby
[11:30:51] ldnunes: has joined #ruby
[11:34:37] Ryzokuken: has joined #ruby
[11:36:26] sytherax_: has joined #ruby
[11:40:39] plexigras: has joined #ruby
[11:41:27] alfiemax: has joined #ruby
[11:45:39] stormpack: has joined #ruby
[11:47:20] alfiemax: has joined #ruby
[11:47:54] ectos: has joined #ruby
[11:50:06] rivalomega: has joined #ruby
[11:51:39] cschneid: has joined #ruby
[11:56:28] conta: has joined #ruby
[11:57:38] alfiemax: has joined #ruby
[11:59:45] synthroid: has joined #ruby
[12:01:28] ectos: has joined #ruby
[12:02:35] sidx64: has joined #ruby
[12:02:49] quobo: has joined #ruby
[12:04:07] lxsameer: has joined #ruby
[12:05:37] duderonomy: has joined #ruby
[12:07:43] gs: has joined #ruby
[12:10:16] Zaab1t: has joined #ruby
[12:12:33] sidx64: has joined #ruby
[12:20:02] Ryzokuken: has joined #ruby
[12:21:58] andrewvos: has left #ruby: ("WeeChat 2.1")
[12:22:41] mikecmpbll: has joined #ruby
[12:34:46] oleo: has joined #ruby
[12:37:03] Bonjourm8: has joined #ruby
[12:42:41] getxsick: has joined #ruby
[12:43:42] tAn: has joined #ruby
[12:46:49] Sembei: has joined #ruby
[12:51:07] donofrio: has joined #ruby
[12:51:33] warrshrike: has joined #ruby
[12:52:07] warrshrike: is there a queue like thing of fixed size which autoremoves the oldest element when a newer is pushed and size is full?
[12:53:15] Zarthus: https://github.com/mephistobooks/fsfifo something like this maybe
[12:53:49] jcalla: has joined #ruby
[12:56:01] conta: has joined #ruby
[13:00:45] warrshrike: nothing BUILT IN?
[13:00:55] warrshrike: even c++ had those stacks and queues in std
[13:02:19] tbuehlmann: there's SizedQueue, but it's not exactly what you're after I guess
[13:03:42] claw: has joined #ruby
[13:04:30] sidx64: has joined #ruby
[13:06:35] k0mpa: has joined #ruby
[13:06:37] sidx64: has joined #ruby
[13:10:45] parzydeuko: has joined #ruby
[13:10:47] mohsen_1: has joined #ruby
[13:25:09] guille-moe: has joined #ruby
[13:27:21] mtkd: has joined #ruby
[13:27:37] parzydeuko: has joined #ruby
[13:30:49] amar: has joined #ruby
[13:32:54] k0mpa1: has joined #ruby
[13:33:59] rawste: has joined #ruby
[13:36:15] schneider: has joined #ruby
[13:36:20] rawste: has joined #ruby
[13:38:37] duderonomy: has joined #ruby
[13:40:15] parzydeuko: has joined #ruby
[13:45:04] bmurt: has joined #ruby
[13:54:39] thapakazi: has joined #ruby
[13:54:46] thapakazi_: has joined #ruby
[14:00:58] Rapture: has joined #ruby
[14:03:19] ilikecakeandpie: has joined #ruby
[14:03:21] bmurt: has joined #ruby
[14:05:09] jrafanie: has joined #ruby
[14:15:57] gnufied: has joined #ruby
[14:20:26] pastorinni: has joined #ruby
[14:22:47] guille-moe: has joined #ruby
[14:23:36] apeiros: has joined #ruby
[14:27:11] schneider: has joined #ruby
[14:29:39] shinnya: has joined #ruby
[14:30:09] chouhoulis: has joined #ruby
[14:30:30] ilikecakeandpie: has joined #ruby
[14:30:56] chouhoul_: has joined #ruby
[14:33:38] rivalomega: has joined #ruby
[14:33:56] Silthias: has joined #ruby
[14:35:22] sidx64: has joined #ruby
[14:37:53] amar: has joined #ruby
[14:39:38] XB23: has joined #ruby
[14:42:54] coderphive: has joined #ruby
[14:47:00] kliq: has joined #ruby
[14:49:46] pastorinni: has joined #ruby
[14:52:39] pastorinni: has joined #ruby
[14:54:32] troys: has joined #ruby
[14:54:55] grilix: has joined #ruby
[14:55:44] amar: has joined #ruby
[14:59:03] rippa: has joined #ruby
[15:01:50] Ryzokuken: has joined #ruby
[15:04:24] chouhoulis: has joined #ruby
[15:05:28] arashb: has joined #ruby
[15:05:48] karapetyan: has joined #ruby
[15:06:23] amar: has joined #ruby
[15:08:23] guille-moe: has joined #ruby
[15:10:26] mohsen_1: has left #ruby: ()
[15:10:39] cschneid: has joined #ruby
[15:12:18] jamesaxl: has joined #ruby
[15:14:39] tAn: has joined #ruby
[15:15:53] apeiros: has joined #ruby
[15:18:11] conr: has joined #ruby
[15:19:28] synthroid: has joined #ruby
[15:21:17] catbusters: has joined #ruby
[15:23:45] apeiros: has joined #ruby
[15:24:13] Mia: has joined #ruby
[15:24:13] Mia: has joined #ruby
[15:24:23] cadillac_: has joined #ruby
[15:25:49] duderonomy: has joined #ruby
[15:32:27] mtkd: has joined #ruby
[15:33:29] WA9ACE: has joined #ruby
[15:35:10] pastorinni: has joined #ruby
[15:35:58] conta: has joined #ruby
[15:36:33] apeiros: has joined #ruby
[15:36:53] Axy: has joined #ruby
[15:37:12] nowhere_man: has joined #ruby
[15:37:31] karapetyan: has joined #ruby
[15:39:28] cyberg: has joined #ruby
[15:39:32] Ryzokuken: has joined #ruby
[15:41:21] cagomez: has joined #ruby
[15:49:57] ipe: has joined #ruby
[15:53:36] apeiros: has joined #ruby
[15:54:19] ruby379: has joined #ruby
[15:54:47] mtkd: has joined #ruby
[15:55:13] ruby330: has joined #ruby
[15:55:45] duderonomy: has joined #ruby
[15:56:35] armyriad: has joined #ruby
[15:58:00] apeiros: has joined #ruby
[15:58:38] karapetyan: has joined #ruby
[16:00:10] guille-moe: has joined #ruby
[16:00:39] pastorinni: has joined #ruby
[16:01:51] dionysus69: has joined #ruby
[16:01:59] jenrzzz: has joined #ruby
[16:09:07] yoones: has joined #ruby
[16:09:47] karapetyan: has joined #ruby
[16:10:29] yoones: Hi! I'm struggeling with bigdecimal stuff. Ruby keeps rounding values when I don't want it to. I even tried to put my value into a string (works well), but then when I add .to_i it rounds it anyway. How can I prevent this behavior?
[16:11:34] elomatreb: yoones: #to_i converts to an integer, which necessarily rounds
[16:11:53] yoones: I tried #floor and #ceil, both round at some point
[16:12:05] yoones: how can I get rid of the decimal part of a number?
[16:12:10] yoones: without rounding
[16:12:17] yoones: truncate also rounds
[16:14:20] ilikecakeandpie: has joined #ruby
[16:14:31] canton7: how do you get rid of the decimal part of a number *without* rounding?
[16:14:35] netfrog: has joined #ruby
[16:14:49] Zarthus: .. you sure you don't want #floor?
[16:15:15] apeiros_: has joined #ruby
[16:15:38] kmurphy4: has joined #ruby
[16:15:56] apeiros: >> 1.7.truncate
[16:15:57] ruby[bot]: apeiros: # => 1 (https://eval.in/1007683)
[16:16:04] apeiros: that's not rounding.
[16:16:09] apeiros: >> 1.7.round # this is
[16:16:10] ruby[bot]: apeiros: # => 2 (https://eval.in/1007684)
[16:16:15] gr33n7007h: has joined #ruby
[16:16:24] canton7: reminds me of https://www.youtube.com/watch?v=BKorP55Aqvg ...
[16:16:38] yoones: I'm working with BigDecimal(value, 14)
[16:16:41] yoones: (14 digits)
[16:16:43] apeiros: or rather: floor is "round down" and ceil is "round up"
[16:17:02] apeiros: yoones: how about you make an actual, reproducible, small example
[16:17:14] elomatreb: Yeah. Input, and expected output
[16:17:24] yoones: floor doesn't work for me
[16:17:42] canton7: you're going to have to explain why... an example is a good way to do that
[16:18:07] apeiros: yoones: "doesn't work" as a problem description doesn't work.
[16:18:10] yoones: I basicaly need to do: expect((big_decimal_value * 100).truncate).to eq(csv_value)
[16:18:23] canton7: right, and what's 'big_decimal_value' and 'csv_value'?
[16:18:30] yoones: I receive a CSV extracted from an Excel file
[16:18:48] apeiros: we do not care about the csv. extract the value and make the example without needing the csv.
[16:18:54] darkhanb: has joined #ruby
[16:19:37] elomatreb: Alternative possibility: You are sure you convert the CSV value to an appropriate type (as it's probably originally a String)? Ruby does not do implicit typecasts like some other scripting languages
[16:20:13] apeiros: >> "12" == 12 # will be false
[16:20:14] ruby[bot]: apeiros: # => false (https://eval.in/1007685)
[16:20:32] apeiros: since the letters 1 followed by 2 is not the same as the value twelve.
[16:20:33] karapetyan: has joined #ruby
[16:20:43] yoones: elomatreb, Yes, I'm comparing BigDecimal.new(csv_extracted_value, 14) with another BigDecimal value
[16:21:27] yoones: elomatreb, The problem I encounter is that the excel-extracted value has been truncated, and I'm comparing it to a ruby-computed result with more precision
[16:22:00] yoones: Trying to truncate it, it gets rounded, which make my life miserable
[16:22:45] apeiros: yeah, no, BigDecimal#truncate does not round. it truncates.
[16:23:01] apeiros: >> require 'bigdecimal'; BigDecimal.new("1.7", 14).truncate
[16:23:03] ruby[bot]: apeiros: # => 1 (https://eval.in/1007686)
[16:23:07] elomatreb: Mh, ok. You probably should share an expected input/expected output then
[16:23:30] yoones: expected: 177469, got: 177469.53 (0.17746953e6)
[16:23:36] yoones: (rspec output)
[16:24:23] apeiros: I'll repeat:
[16:24:32] apeiros: remove all the boilerplate which is not essential to your problem
[16:24:39] apeiros: make that demo case
[16:24:42] apeiros: and show us that
[16:24:44] yoones: apeiros, I'm trying
[16:25:11] apeiros: that sounds like you fail - which indicates that your problem does not lie with bigdecimal but your test setup.
[16:25:23] nitric: has joined #ruby
[16:25:24] elomatreb: >> BigDecimal(177469.53, 14).truncate
[16:25:25] ruby[bot]: elomatreb: # => undefined method `BigDecimal' for main:Object (NoMethodError) ...check link for more (https://eval.in/1007687)
[16:25:32] apeiros: yoones: do you know pry?
[16:26:28] eb0t: has joined #ruby
[16:26:30] yoones: elomatreb, If you instanciate it this way, yes. When you get it as the result of a computation, nope
[16:26:42] def_jam: has joined #ruby
[16:26:51] ipee: has joined #ruby
[16:27:05] apeiros: >> require 'bigdecimal'; BigDecimal.new(1774.6953*100, 14).truncate
[16:27:06] ruby[bot]: apeiros: # => 177469 (https://eval.in/1007688)
[16:27:11] apeiros: ^ with computation
[16:27:22] apeiros: again, do you know pry, yoones?
[16:28:08] apeiros: add pry to your Gemfile, or if you don't use gemfiles, install it. require 'pry' in your testcase.
[16:28:42] yoones: => 0.17746953e8
[16:29:26] apeiros: rewrite your testcase from `expect((big_decimal_value * 100).truncate).to eq(csv_value)` to `actual = (big_decimal_value * 100).truncate; p actual_class: actual.class, csv_value_class: csv_value.class, actual: actual, csv: csv_value; expect(actual).to eq(csv_value)`
[16:29:34] apeiros: you can use newlines instead of ;
[16:30:00] apeiros: also provide us the RUBY_VERSION you're using.
[16:30:49] SeepingN: has joined #ruby
[16:33:55] DoubleMalt: has joined #ruby
[16:34:04] guacamole: has joined #ruby
[16:34:05] guacamole: has joined #ruby
[16:34:11] yoones: ruby 2.3.6p384 https://pastebin.com/62jtsXnt
[16:34:11] ruby[bot]: yoones: as I told you already, please use https://gist.github.com
[16:34:36] coderphive: has joined #ruby
[16:35:29] apeiros: any reason you deviated from what I asked you to do?
[16:35:44] safetypin: has joined #ruby
[16:35:45] apeiros: I mean I can work with it, but I'm curious
[16:36:43] yoones: Because big_decimal_value doesn't work, it's pseudo code to ask a question here, my code is a big more complicated
[16:36:52] ipeee: has joined #ruby
[16:36:56] yoones: doesn't exist*
[16:37:09] apeiros: ok, but that doesn't explain the other deviations
[16:37:16] yoones: I found an ugly hack
[16:37:29] yoones: value.to_s('F').split(".").first
[16:37:55] yoones: I guess I'll go with it
[16:39:42] apeiros: ACTION rolls eyes
[16:40:07] apeiros: yeah, got better ways to waste my time than somebody who seeks help but doesn't see fit to help those trying to help.
[16:40:09] amar: has joined #ruby
[16:41:36] conta: has joined #ruby
[16:41:44] yoones: thanks for trying to help
[16:42:49] amar: has joined #ruby
[16:44:47] eblip: has joined #ruby
[16:47:49] sytherax_: has joined #ruby
[16:50:30] sanscoeur: has joined #ruby
[16:51:29] mikecmpbll: has joined #ruby
[16:53:44] WAFFLEMAKER3000: has joined #ruby
[16:56:33] WAFFLEMAKER3000: has joined #ruby
[16:56:49] apeiros: welcome back?
[16:58:27] WAFFLEMAKER3000: has left #ruby: ()
[16:58:49] WAFFLEMAKER3000: has joined #ruby
[16:59:44] amar: has joined #ruby
[17:00:29] sytherax_: has joined #ruby
[17:01:41] sytherax_: has joined #ruby
[17:03:18] rawste: has joined #ruby
[17:04:40] DeepIO: has joined #ruby
[17:08:50] alfiemax: has joined #ruby
[17:14:00] jenrzzz: has joined #ruby
[17:17:45] sphenxes: has joined #ruby
[17:19:45] Eiam: do people here actually depend on the system ruby to do anything? like the default version of ruby that ships with macOS for example
[17:20:19] Eiam: when I was first getting started I used it, then i moved to rvm, later rbenv, and it seems like most developers stop using the system version of interpreters when they move into actually using the language. wondering if I'm the exception
[17:22:52] elomatreb: It really depends on your OS, e.g. on Arch we don't really have outdated rubies
[17:26:31] Eiam: well depending on the OS version means at some point your software will be used with something you didnt' test it with either ?
[17:26:52] Eiam: im wondering aloud if it would matter if OSes stopped shipping with interpreters out of the box
[17:27:09] nowhere_man: has joined #ruby
[17:27:33] sidx64: has joined #ruby
[17:28:45] seabee: has joined #ruby
[17:29:09] elomatreb: You have to specify the version in some form anyway, if you don't depend on the OS version you have to either mention it in a readme or include it in some machine-readable form for the people who manually install/build (or use a tool) Ruby
[17:29:27] ilikecakeandpie: has joined #ruby
[17:29:50] elomatreb: It would matter, probably not so much in Rubies case but e.g. python and even the shells are essential for OSes
[17:29:52] apeiros: Eiam: I'm on osx and I don't touch system ruby. and I think wouldn't on any box I haven't tailor-made for some purpose.
[17:31:35] coderphive: has joined #ruby
[17:32:36] nicesignal: has joined #ruby
[17:33:10] chouhoul_: has joined #ruby
[17:33:25] amar: has joined #ruby
[17:37:12] Eiam: elomatreb: generally one would bundle their dependencies that are relevant to control
[17:37:24] Eiam: i.e. if you depend on ruby 2.3 you should bundle ruby 2.3
[17:37:58] Eiam: elomatreb: same problem exists for python, python 2 vs python 3, etc
[17:38:25] elomatreb: That gets you the node-ism of endless duplicates of stuff
[17:38:59] Eiam: elomatreb: the file system can de-dupe that stuff for you if its that big of a deal
[17:39:03] Eiam: but disk space is pretty cheap these days
[17:40:01] elomatreb: Not just the pure space. I recently ran out of inodes on a partition because I had a few larger node_modules directories on it
[17:40:17] apeiros: elomatreb: lulwot? :D
[17:41:16] Eiam: we can find edge cases for any scenario, i don't think thats terribly common or worth hand wringing
[17:41:18] elomatreb: Weird as hell to debug, because none of the tools give proper error messages
[17:41:28] Eiam: the OS already doesn't provide node dependencies, no OS does
[17:41:35] Eiam: every app is required to bring those along with them.
[17:41:55] Eiam: or bring a way to install them
[17:42:06] elomatreb: I'm not against ecosystem-specific dependency management, but saying "just bundle it and ship" is unnecessarily wasteful
[17:42:30] elomatreb: Not everyone can just hit the "give larger instance" button on $cloudProvider
[17:42:44] Eiam: I fail to see how its wasteful , ruby is 50kb
[17:43:16] Eiam: thats effectively 'nothing' even if you have 1000 apps require it
[17:45:38] tAn: has joined #ruby
[17:53:49] amar: has joined #ruby
[17:54:20] alfiemax: has joined #ruby
[17:55:51] slash_nick: has joined #ruby
[17:58:35] havenwood: Eiam: On OSes that have nice up-to-date Ruby packages, I often use those. When you're on a dev machine with multiple legacy apps, some are always going to be on some Ruby enging/version. For that case, it's nice to be able to use system Ruby or one of your choosing.
[17:58:59] havenwood: Eiam: Here's an example of a chruby setup with arch: https://gist.github.com/jhass/8839655bb038e829fba1
[17:58:59] amar: has joined #ruby
[17:59:00] WAFFLEMAKER3000: has joined #ruby
[17:59:30] havenwood: Eiam: Since Arch always has a nice recent Ruby, it's worth using. Then you can switch to custom-installed Rubies easily.
[17:59:56] Eiam: but if you user is on an old version of arch that doesn't have an updated ruby
[17:59:59] Eiam: you are in the same boat
[17:59:59] mtkd: has joined #ruby
[18:00:56] mahlon: has joined #ruby
[18:02:05] al2o3-cr: pacman -Syu ;)
[18:03:28] guille-moe: has joined #ruby
[18:03:58] suukim: has joined #ruby
[18:06:21] nowhere_man: has joined #ruby
[18:06:58] guacamole: has joined #ruby
[18:06:58] guacamole: has joined #ruby
[18:07:02] RougeR: has joined #ruby
[18:08:13] duderonomy: has joined #ruby
[18:10:26] guacamole: has joined #ruby
[18:10:26] guacamole: has joined #ruby
[18:12:23] amatas: has joined #ruby
[18:16:05] duderonomy: has joined #ruby
[18:17:13] karapetyan: has joined #ruby
[18:19:18] duderono_: has joined #ruby
[18:20:13] nitric_: has joined #ruby
[18:23:47] guacamole: has joined #ruby
[18:23:47] guacamole: has joined #ruby
[18:23:47] chouhoulis: has joined #ruby
[18:25:54] ramfjord: has joined #ruby
[18:27:43] fsmauri21: has joined #ruby
[18:29:25] Mia: has joined #ruby
[18:33:25] pilne: has joined #ruby
[18:36:47] grilix: has joined #ruby
[18:37:23] duderonomy: has joined #ruby
[18:40:28] darkhanb: has joined #ruby
[18:44:26] reaVer: has joined #ruby
[18:44:42] SeepingN: has joined #ruby
[18:46:08] dviola: has joined #ruby
[18:51:35] rcvalle: has joined #ruby
[18:55:31] quuxman: I'm eating yogurt now as it happens
[18:57:29] plexigras: has joined #ruby
[18:58:10] fsmauri21: My, and here I was excited about having some Pea soup.
[19:03:05] pskosinski: has joined #ruby
[19:03:18] duderonomy: has joined #ruby
[19:04:44] karapetyan: has joined #ruby
[19:05:07] catbusters: has joined #ruby
[19:06:20] banisterfiend: has joined #ruby
[19:06:20] parzydeuko: has joined #ruby
[19:06:33] bmurt: has joined #ruby
[19:08:10] jottr: has joined #ruby
[19:09:53] duderono_: has joined #ruby
[19:14:18] _aeris_: has joined #ruby
[19:17:25] cyberg: has joined #ruby
[19:19:19] duderonomy: has joined #ruby
[19:20:18] cagomez: has joined #ruby
[19:24:13] bmurt: has joined #ruby
[19:25:02] tedgu: has joined #ruby
[19:26:30] cschneid: has joined #ruby
[19:27:38] Ryzokuken: has joined #ruby
[19:28:35] Rapture: has joined #ruby
[19:28:41] quuxman: it was with a chopped apple, a sectioned orange, and a bit of granola :-}
[19:29:00] c0ncealed1: has joined #ruby
[19:29:30] quuxman: so I'm still wondering what I asked on Friday: there must be a better way to write `foo.each do |x| bar_method x end` right?
[19:29:56] apeiros: there are gems to do it in a shorter way, but vanilla ruby - no
[19:30:24] quuxman: omg. that's really how you're supposed to do "l.map(foo)"?
[19:30:52] quuxman: er, 'foo.map(bar)' to keep my metasyntactic vars consistent
[19:31:44] elomatreb: You can do foo.map(&method(:bar)), but that's not much prettier
[19:31:55] quuxman: rawr! *flips table*
[19:33:18] quuxman: taht second looks nicer, but only works if bar is in the same scope, and not a parameter
[19:34:39] cschneid_: has joined #ruby
[19:35:54] cschneid: has joined #ruby
[19:37:10] cagomez: has joined #ruby
[19:40:03] priodev: has joined #ruby
[19:43:05] elomatreb: If you want some other method you have to detach it accordingly, e.g. `foo.map &BazModule.method(:bar)`
[19:43:38] cyberg: has joined #ruby
[19:45:38] duderonomy: has joined #ruby
[19:46:41] quuxman: what about a variable referencing a function?
[19:46:52] jrafanie: has joined #ruby
[19:47:32] havenwood: quuxman: Matz recently weighed in favorably on the possibility of a new operator that would help.
[19:48:16] elomatreb: quuxman: You can pass around method objects like any other object, but it gets clunky very quickly
[19:48:49] elomatreb: & then calls to_proc on them, which is why e.g. &:stuff works (Symbol#to_proc)
[19:49:11] havenwood: quuxman: It'd be: Foo.map &BazModule.:bar
[19:49:17] havenwood: I like the .: proposal.
[19:49:24] quuxman: so Ruby strongly discourages functional programming, at least syntactically. It's pretty weird having a dynamic language treat function variables specially, but I suppose it's the ambiguous call syntax that makes the whole mess
[19:49:48] havenwood: `.:` is better than `->` ~Matz
[19:50:26] elomatreb: There's nothing special about "function variables", they're regular instances of the Method class
[19:50:49] sytherax_: has joined #ruby
[19:51:24] nickjj: has joined #ruby
[19:51:42] cyberg: has joined #ruby
[19:52:10] havenwood: quuxman: Would you consider this syntax to no longer be discouraging functional programming?: Foo.map &BazModule.:bar
[19:52:33] havenwood: quuxman: You might get a Christmas present.
[19:53:13] havenwood: I'd love that, personally.
[19:53:21] elomatreb: Will that be sugar for .method, or do something "special"?
[19:53:46] quuxman: what's the ampersand?
[19:54:50] elomatreb: It calls #to_proc on the given object, so the method receives a block it can yield to
[19:55:32] havenwood: quuxman: It passes a proc as a block.
[19:55:35] guacamole: has joined #ruby
[19:55:35] guacamole: has joined #ruby
[19:55:41] elomatreb: E.g. Symbol#to_proc returns a proc that sends itself (the Symbol) to the yielded object
[19:56:06] quuxman: I read a whole article about the difference between procs and blocks, and I'm not any more clear on them
[19:56:43] elomatreb: It mostly doesn't matter, because very few people are clear on them so they're used interchangeable
[19:57:12] havenwood: elomatreb: Yeah, it's just a patch to parse.y that calls the "method" method.
[19:57:25] havenwood: I wonder if I'd prefer #public_method.
[19:57:36] havenwood: ACTION ponders
[19:57:40] elomatreb: They only difference you do sometimes need to worry about is between procs and lambdas concerning the behavior of returns and breaks
[19:58:00] elomatreb: Yeah, it should obey visibility restrictions by default (I take it regular #method does not?)
[20:00:00] alfiemax: has joined #ruby
[20:01:07] tAn: has joined #ruby
[20:03:54] cyberg: has joined #ruby
[20:09:24] schneider: has joined #ruby
[20:09:27] pastorinni: has joined #ruby
[20:13:19] sumobob: has joined #ruby
[20:14:21] nowhere_man: has joined #ruby
[20:14:26] white_lilies: has joined #ruby
[20:14:28] kmurphy4: has joined #ruby
[20:15:29] quuxman: ok good to know. So what would leaving out the ampersand do? For example `foo.map(method(:bar))`?
[20:16:05] apeiros: it would call the method map with a single argument
[20:16:43] elomatreb: It's like saying foo.map(12)
[20:16:47] apeiros: that argument usually being an instance of Method, but really, depends on what self.method(:bar) in that context returns (like all implicit method calls)
[20:17:22] apeiros: ACTION nitpicks: it's like saying foo.map(bar(12))
[20:17:47] apeiros: oh well, that could be misconstrued. it's like: foo.map(blupp(:bar))
[20:18:07] cagomez: has joined #ruby
[20:18:12] elomatreb: I meant in the sense that it's an invalid/nonsensical usage, and will error
[20:18:29] quuxman: so how is the ampersand not redundant?
[20:18:35] apeiros: that depends on what foo.map does :)
[20:18:44] apeiros: but sure, Enumerable#map will bomb
[20:19:03] quuxman: and what is "blupp"? where did that come from?
[20:19:35] apeiros: it's a stand in for "you're calling a method"
[20:20:11] quuxman: on what? Leaving out the ampersand somehow makes an implicit method call on some object?
[20:20:23] elliottcable: I haven't written Ruby in … a miiiiinute
[20:20:27] elliottcable: (ten years???)
[20:20:41] apeiros: it's never "on some object", and it's a method call with the ampersand too.
[20:20:53] apeiros: method calls without receiver are always on self.
[20:20:56] elliottcable: I can't, for the life of me, remember how to “open” (in the OCaml sense) a module in Ruby
[20:21:03] havenwood: quuxman: In Ruby a block is a special thing. It often doesn't have an object allocated. You can pass a proc or method object as a block with &.
[20:21:04] apeiros: and what a method does always depends on the receiver.
[20:21:27] havenwood: ELLIOTTCABLE: You can just reopen the module like: module Foo; ... end
[20:21:28] sagax: has joined #ruby
[20:21:38] quuxman: havenwood: ah ok.
[20:21:39] apeiros: meaning: foo.map may or may not be Enumerable#map. method(:bar) may or may not be Object#method.
[20:22:14] elliottcable: if I have `require 'CoolProj'` and a lot of `CoolProj::Blah.new`,
[20:22:30] elliottcable: how can I stop typing `CoolProj::` every three seconds in a consuming file?
[20:22:38] apeiros: but maybe we can change this to something which makes more sense to you: `foo.map(method(:bar))` is the same as `some_arg = method(:bar); foo.map(some_arg)`
[20:22:54] quuxman: So what if I make a def at the top level, like `def foo(x) put x end` and then call it with `foo x`. If everything is a method call, what object is receiving foo?
[20:23:06] solocshaw: has joined #ruby
[20:23:09] havenwood: ELLIOTTCABLE: Assuming it's a module: include CoolProj
[20:23:23] apeiros: as said before: methods invoked without an explicit receiver are always sent to self.
[20:23:30] elliottcable: even at the root level of a file?
[20:23:47] quuxman: what's self at the top level?
[20:23:59] apeiros: just ask it
[20:24:06] havenwood: ELLIOTTCABLE: You can include at any level. It depends on what you're doing.
[20:24:07] apeiros: (main, an instance of Object)
[20:24:32] havenwood: >> class << self; undef inspect end; self
[20:24:33] ruby[bot]: havenwood: # => /tmp/execpad-5caf97649c93/source-5caf97649c93:1:in `p': undefined method `inspect' for #<Object:0x40 ...check link for more (https://eval.in/1007801)
[20:25:02] quuxman: heh. main is not defined, because presumably it's referencing main.main
[20:25:05] elliottcable: specifically, at the moment, in specs
[20:25:29] havenwood: quuxman: main is an instance of Object that likes to call itself "main"
[20:26:04] elomatreb: But there isn't anything really special about it otherwise
[20:26:19] havenwood: >> def foo; end; method(:foo).owner
[20:26:20] ruby[bot]: havenwood: # => Object (https://eval.in/1007802)
[20:26:36] havenwood: >> Object.private_method_defined?(:foo)
[20:26:37] ruby[bot]: havenwood: # => false (https://eval.in/1007803)
[20:27:45] havenwood: >> AIM = true; Object.const_defined(:AIM, false)
[20:27:46] ruby[bot]: havenwood: # => undefined method `const_defined' for Object:Class ...check link for more (https://eval.in/1007804)
[20:27:54] havenwood: >> AIM = true; Object.const_defined?(:AIM, false)
[20:27:54] jenrzzz: has joined #ruby
[20:27:54] jenrzzz: has joined #ruby
[20:27:54] ruby[bot]: havenwood: # => true (https://eval.in/1007805)
[20:28:24] havenwood: It's a kinda weird anonymous object and class hybrid. ¯\_(ツ)_/¯
[20:32:11] havenwood: banister did a writeup on main: https://banisterfiend.wordpress.com/2010/11/23/what-is-the-ruby-top-level/
[20:34:23] pastorinni: has joined #ruby
[20:35:41] alfiemax: has joined #ruby
[20:35:57] noobineer: has joined #ruby
[20:36:49] cyberg: has joined #ruby
[20:39:54] bmurt: has joined #ruby
[20:46:01] parzydeu1: has joined #ruby
[20:49:06] c0ncealed1: has joined #ruby
[20:53:38] pastorinni: has joined #ruby
[20:54:11] sidx64: has joined #ruby
[20:55:50] orbyt_: has joined #ruby
[20:59:47] Ryzokuken: has joined #ruby
[21:01:25] ciscam: has joined #ruby
[21:07:49] tAn: has joined #ruby
[21:10:14] cyberg: has joined #ruby
[21:15:45] alfiemax: has joined #ruby
[21:16:33] pskosinski: has joined #ruby
[21:19:22] ur5us: has joined #ruby
[21:23:06] grilix: has joined #ruby
[21:23:39] quuxman: in irb, Is there a way to get to a debugger running in the stack frame of the last exception?
[21:24:42] guacamole: has joined #ruby
[21:24:42] guacamole: has joined #ruby
[21:27:59] RougeR: has joined #ruby
[21:27:59] RougeR: has joined #ruby
[21:28:29] sumobob: has joined #ruby
[21:32:14] amar_: has joined #ruby
[21:33:12] sumobob: has joined #ruby
[21:34:43] alfiemax: has joined #ruby
[21:35:30] tacoboy: has joined #ruby
[21:39:44] karapetyan: has joined #ruby
[21:40:49] Lytol: has joined #ruby
[21:40:57] gigetoo: has joined #ruby
[21:42:54] quuxman: eh forget trying to debug Ruby, I've been down this road before
[21:43:08] safetypin: has joined #ruby
[21:44:58] nolanv: has joined #ruby
[21:47:44] alfiemax: has joined #ruby
[21:49:50] bayprogrammer: has joined #ruby
[21:55:03] cagomez: has joined #ruby
[21:56:24] jjunior__: has joined #ruby
[21:57:59] sanscoeur: has joined #ruby
[21:58:15] chouhoul_: has joined #ruby
[22:00:45] quuxman: can I use ActiveRecord to return dicts instead of ActiveRecord instances?
[22:05:09] alfiemax: has joined #ruby
[22:06:59] baweaver: quuxman: Probably a Rails question
[22:07:09] baweaver: Also Ruby doesn't have dicts, do you mean hashes?
[22:07:31] baweaver: `to_h` works as a coercion
[22:08:44] cagomez: has joined #ruby
[22:09:08] AJA4350: has joined #ruby
[22:09:14] jenrzzz: has joined #ruby
[22:09:26] amar: has joined #ruby
[22:09:31] audy: quuxman: record.attributes
[22:10:00] audy: but activerecord instances behave like hashes anyway
[22:10:04] amar: has joined #ruby
[22:10:14] havenwood: quuxman: Why do you care that it's a Hash?
[22:10:48] havenwood: quuxman: What about the Hash class is appealing? The methods it responds to? Serialization?
[22:13:58] ur5us: has joined #ruby
[22:23:03] alfiemax: has joined #ruby
[22:23:55] cyberg: has joined #ruby
[22:26:20] nolanv: has joined #ruby
[22:26:47] stairmast0r: has joined #ruby
[22:32:22] sanscoeur: has joined #ruby
[22:34:26] mikecmpbll: has joined #ruby
[22:34:26] amar: has joined #ruby
[22:37:14] orbyt_: has joined #ruby
[22:40:00] alfiemax: has joined #ruby
[22:44:35] ramfjord: has joined #ruby
[22:44:55] \void: has joined #ruby
[22:49:45] jenrzzz: has joined #ruby
[22:57:19] alfiemax: has joined #ruby
[22:57:47] nowhere_man: has joined #ruby
[22:58:06] white_lilies: has joined #ruby
[22:58:22] noobineer: has joined #ruby
[22:58:57] tw1sted: has joined #ruby
[22:59:54] camilasan: has joined #ruby
[23:00:27] SegFaultAX: has joined #ruby
[23:03:05] cpallares: has joined #ruby
[23:06:22] ogres: has joined #ruby
[23:10:02] \13k: has joined #ruby
[23:10:05] cajone: has joined #ruby
[23:13:00] venmx: has joined #ruby
[23:14:37] alfiemax: has joined #ruby
[23:19:45] kimoto: has joined #ruby
[23:27:30] karapetyan: has joined #ruby
[23:28:50] harrycs: has joined #ruby
[23:30:19] emilford: has joined #ruby
[23:31:46] minimalism: has joined #ruby
[23:32:38] ramfjord: has joined #ruby
[23:41:21] ramfjord: has joined #ruby
[23:47:18] ramfjord: has joined #ruby
[23:49:40] quuxman: turns out I just need to pass a skip validation param
[23:49:58] alfiemax: has joined #ruby
[23:56:00] ciscam: has joined #ruby
[23:56:18] emilford: has joined #ruby