« Back to channel list

#ruby - 10 October 2017

« Back 1 day Forward 1 day »
[00:04:59] TinkerTyper: has joined #ruby
[00:10:22] jenrzzz: has joined #ruby
[00:10:22] jenrzzz: has joined #ruby
[00:10:29] TinkerTyper: has joined #ruby
[00:13:29] TinkerTyper: has joined #ruby
[00:18:19] TinkerTyper: has joined #ruby
[00:22:51] rrichardsr3: has joined #ruby
[00:23:19] SteenJobs_: has joined #ruby
[00:24:02] Puffball: has joined #ruby
[00:26:00] cagomez: has joined #ruby
[00:32:45] orbyt_: has joined #ruby
[00:35:07] gusrub: has joined #ruby
[00:36:14] bmurt: has joined #ruby
[00:36:33] p0p0pr37: has joined #ruby
[00:41:58] jtdoncas: has joined #ruby
[00:47:54] QualityAddict: has joined #ruby
[00:48:06] Xiti: has joined #ruby
[00:50:52] eckhardt: has joined #ruby
[00:52:37] faces: has joined #ruby
[00:54:42] enko: has joined #ruby
[00:55:06] rrichardsr3: has joined #ruby
[00:55:30] jtdoncas: has joined #ruby
[00:56:33] amirite: has joined #ruby
[00:59:13] bronson: has joined #ruby
[01:00:18] enterprisey: has joined #ruby
[01:03:06] astrobunny: has joined #ruby
[01:07:55] jenrzzz: has joined #ruby
[01:14:05] alfiemax: has joined #ruby
[01:30:27] herbmillerjr: has joined #ruby
[01:31:32] ramfjord: has joined #ruby
[01:32:44] uneeb: has joined #ruby
[01:37:41] ramfjord: has joined #ruby
[01:38:42] alfiemax: has joined #ruby
[01:39:02] uZiel: has joined #ruby
[01:42:49] jtdoncas_: has joined #ruby
[01:43:48] d^sh: has joined #ruby
[01:44:02] ramfjord: has joined #ruby
[01:49:21] jtdoncas: has joined #ruby
[01:49:56] wutschkef: has joined #ruby
[01:50:15] __Yiota: has joined #ruby
[01:51:19] gizmore|2: has joined #ruby
[01:56:11] mim1k: has joined #ruby
[01:57:24] p0p0pr37: has joined #ruby
[01:58:02] jenrzzz: has joined #ruby
[01:58:02] jenrzzz: has joined #ruby
[02:01:07] amirite: has joined #ruby
[02:04:41] __Yiota: has joined #ruby
[02:04:58] Axsuul: has joined #ruby
[02:06:46] Axsuul: has joined #ruby
[02:08:33] meadmoon: has joined #ruby
[02:09:24] marcux: has joined #ruby
[02:12:16] amirite: has joined #ruby
[02:14:28] Axsuul: has joined #ruby
[02:15:48] p0p0pr37_: has joined #ruby
[02:20:43] chrisgopher: has joined #ruby
[02:21:41] amirite: has joined #ruby
[02:24:17] neon_icon: has joined #ruby
[02:27:00] neon_icon: has joined #ruby
[02:27:17] neon_iconstar: has joined #ruby
[02:38:18] eckhardt: has joined #ruby
[02:43:00] harfangk: has joined #ruby
[02:45:54] Derperperd: has joined #ruby
[02:47:06] wutschkef: has joined #ruby
[02:50:01] Derperperd: has joined #ruby
[02:50:11] amirite: has joined #ruby
[02:52:46] ramfjord: has joined #ruby
[02:55:09] Derperperd: has joined #ruby
[02:56:52] cdg: has joined #ruby
[02:58:32] ramfjord: has joined #ruby
[03:00:02] bronson: has joined #ruby
[03:00:10] cadillac_: has joined #ruby
[03:00:16] A124: has joined #ruby
[03:01:17] kies: has joined #ruby
[03:02:24] DTZUZO: has joined #ruby
[03:05:07] amirite: has joined #ruby
[03:14:34] consti: has joined #ruby
[03:18:40] cadillac_: has joined #ruby
[03:19:38] gix: has joined #ruby
[03:24:07] cschneid_: has joined #ruby
[03:37:48] orbyt_: has joined #ruby
[03:39:15] zarubin: has joined #ruby
[03:39:40] nadir: has joined #ruby
[03:44:56] wutschkef: has joined #ruby
[03:46:48] dinfuehr: has joined #ruby
[03:47:27] Derperperd: has joined #ruby
[03:51:40] jtdoncas: has joined #ruby
[03:53:02] uZiel: has joined #ruby
[03:53:49] Derperperd: has joined #ruby
[03:55:42] jtdoncas_: has joined #ruby
[03:56:41] mim1k: has joined #ruby
[03:57:02] Derperperd: has joined #ruby
[04:00:08] ramfjord: has joined #ruby
[04:00:42] wutschkef: has joined #ruby
[04:01:30] alfiemax: has joined #ruby
[04:01:41] tsglove: has joined #ruby
[04:07:19] neon_iconstar: has joined #ruby
[04:16:29] wutschkef: has joined #ruby
[04:19:56] enko: has joined #ruby
[04:20:58] ramfjord: has joined #ruby
[04:22:46] burgestrand: has joined #ruby
[04:23:56] Bhootrk_: has joined #ruby
[04:24:54] Derperperd: has joined #ruby
[04:26:00] Derperperd: has joined #ruby
[04:30:14] Derperperd: has joined #ruby
[04:31:12] bronson: has joined #ruby
[04:32:14] wutschkef: has joined #ruby
[04:35:05] govg: has joined #ruby
[04:37:10] jtdoncas: has joined #ruby
[04:38:31] Derperperd: has joined #ruby
[04:46:57] Derperperd: has joined #ruby
[04:47:25] mim1k: has joined #ruby
[04:48:01] wutschkef: has joined #ruby
[04:48:12] tamouse__: has joined #ruby
[04:50:45] nofxx: has joined #ruby
[04:51:00] jinie: has joined #ruby
[04:51:54] Nobun: has joined #ruby
[04:52:05] Nobun: Hi. again about embedding ruby.
[04:52:06] Bock: has joined #ruby
[04:52:52] Nobun: please can someone tell me how ACTUALLY I can send a VALUE as string? becouse this code does not work:
[04:55:19] eckhardt: has joined #ruby
[04:56:04] Nobun: http://dpaste.com/1EHJXD9
[04:56:26] jtdoncas_: has joined #ruby
[04:57:48] Nobun: this is test.rb: http://dpaste.com/2NV91K2
[04:58:19] neon_icon: has joined #ruby
[04:59:59] Nobun: application result: only "hello" is displayed (printed from class Octavia) but not "PQR" (as expected from main.c line 11
[05:00:12] Nobun: only "hellp" is displayed... sorry
[05:00:33] Nobun: (becouse I did this mistype)
[05:01:21] Nobun: so... rb_str_new_cstr("PQR") --> did not actually convert "PQR" string to value
[05:01:42] Nobun: I also tried rb_str_new2 and rb_str_new (with string length) but the same problem
[05:01:54] ramfjord: has joined #ruby
[05:02:15] Nobun: it is like the CoreVxa.projdir internal variable is always empty
[05:02:42] Nobun: even if should be initialized on initialize like it was in the Octavia class
[05:03:06] matthewd: Yeah, it seems more likely an ivar issue than a string allocation one
[05:03:07] krz: has joined #ruby
[05:03:31] matthewd: Is cv_init being invoked?
[05:03:31] Nobun: oh, matthewd ... nice to see you again.
[05:03:48] wutschkef: has joined #ruby
[05:03:49] Nobun: matthewd, I assume so...
[05:03:59] tcopeland: has joined #ruby
[05:04:13] Nobun: rb_define_method(rbCoreVxa, "initialize", cv_init, 0);
[05:04:28] Nobun: it is defined as "initialize" method
[05:04:41] Nobun: so it should be invoked when ruby calls CoreVxa.new
[05:04:48] matthewd: I'd be adding a prinft/cout/whatever to confirm
[05:05:38] Nobun: well... I will add it... wait a moment...
[05:06:39] Nobun: yes, mattew, I confirm
[05:06:43] Nobun: printf("INIT is executed\n");
[05:06:49] Nobun: I added this in cv_init
[05:06:53] Nobun: and it is displayed
[05:07:55] matthewd: You're setting the ivar on the class, not the instance
[05:08:07] matthewd: You want rb_iv_set(self, ...etc)
[05:08:44] Cohedrin_: has joined #ruby
[05:09:11] Nobun: YEAH. now it works
[05:09:18] Nobun: wow... it was painful :(
[05:09:25] Nobun: now trying to convert in c++
[05:10:06] Nobun: I saw that using module never allocates the variables like it happened here
[05:10:36] Nobun: so why I tried to switch to an actual class, but I faced the same problem. In this case using self seems working.
[05:10:59] Nobun: now trying to switch to the complete sample code I was trying yesterday evening
[05:11:24] rrichardsr3: has joined #ruby
[05:11:53] matthewd: If you want a single global instance, maybe you do want a module.. but you can worry about that later
[05:17:53] Nobun: yes... after all my main concern is that the code will work... even if not perfect
[05:19:39] wutschkef: has joined #ruby
[05:20:48] Nobun: hmm any idea how to return properly, for example, @projdir ?
[05:20:57] tcopeland1: has joined #ruby
[05:21:00] lexruee: has joined #ruby
[05:21:13] Nobun: in a different function than initialize() I mean
[05:22:10] Nobun: I'd like to implement the getters() and try if they work (together with instance_variable_get wich are used only for testing purposes)
[05:22:12] matthewd: return rb_iv_get(self, "@projdir"); ?
[05:22:46] Nobun: hmm... yeah... I feel a bit stupid... I could gess it, this time :/
[05:22:53] matthewd: I'd generally advise against implementing in C(++) that which you can implement in ruby, fwiw
[05:23:23] Nobun: matthewd, you are right, but this class is needed becouse is a sort of workaround
[05:24:07] Nobun: unlike python and lua, infact, I didn't see any clear way to allow script to comunicate to the application
[05:24:54] milardovich: has joined #ruby
[05:25:15] Nobun: this way the script will be executed and the CoreVxa class (or module) will be used to obtain informations from application and to return informations to application
[05:25:30] matthewd: Implementing a class in C++ to talk to the rest of the C++ app is perfectly reasonable
[05:25:59] matthewd: That's not the part I was questioning -- just the part where you start manually implementing instance variable accessors
[05:27:09] paranoicsan: has joined #ruby
[05:27:13] Nobun: can I do it in ruby... but how? As long as I am defining the CoreVxa class in C++ how I supposed to add method to the same class in Ruby? (sorry but I have a bit difficulties on understanding this language)
[05:28:26] Nobun: that should be very nice if I can avoid to implement some additional C++ code
[05:28:41] Nobun: that I could avoid using few lines of Ruby instead
[05:29:30] cschneid_: has joined #ruby
[05:30:18] Nobun: ah but perhaps I can simply make a derived class....
[05:30:22] matthewd: class CoreVxa; attr_accessor :projdir; end
[05:30:53] Nobun: and I can add this into Ruby even if CoreVxa is already defined?
[05:30:56] matthewd: You can just reopen the class and add methods at will
[05:31:29] matthewd: (equally for something already defined in ruby code, or for core classes like String)
[05:31:40] Nobun: ah ok. so you can have multiple class SameClassName to add features at different points... interesting
[05:35:20] wutschkef: has joined #ruby
[05:36:56] Nobun: but, however, to communicate with application (for the retval the script should be set in corevxa... for that value it is better to have a setter and not an attr_accessor so I can convert VALUE to string
[05:37:15] Nobun: (a setter in C++, I mean)
[05:42:38] rabajaj: has joined #ruby
[05:43:50] enko: has joined #ruby
[05:45:22] anisha: has joined #ruby
[05:48:50] Mia: has joined #ruby
[05:48:50] Mia: has joined #ruby
[05:51:07] wutschkef: has joined #ruby
[05:58:26] milardovich: has joined #ruby
[06:05:04] KevinSjoberg: has joined #ruby
[06:05:09] aupadhye: has joined #ruby
[06:06:36] cdg: has joined #ruby
[06:06:53] wutschkef: has joined #ruby
[06:13:05] uZiel: has joined #ruby
[06:15:56] neon_icon: has joined #ruby
[06:16:47] jenrzzz: has joined #ruby
[06:16:59] waveprop: has joined #ruby
[06:17:24] armyriad: has joined #ruby
[06:18:39] jrm: has joined #ruby
[06:18:52] KevinSjoberg: has joined #ruby
[06:20:42] nicolai86: has joined #ruby
[06:22:10] mjolnird: has joined #ruby
[06:22:35] waveprop: does ruby support functional paradigm
[06:22:44] wutschkef: has joined #ruby
[06:24:44] kliq: has joined #ruby
[06:26:09] elsevero: has joined #ruby
[06:26:41] alex``: has joined #ruby
[06:33:05] elcontrastador: has joined #ruby
[06:38:26] wutschkef: has joined #ruby
[06:40:04] quobo: has joined #ruby
[06:40:26] Mon_Ouie: has joined #ruby
[06:41:12] Nobun: matthewd: I cannot find a good way to convert RUBY string to c_string
[06:41:41] matthewd: StringValueCStr(v)
[06:41:47] uZiel: has joined #ruby
[06:42:02] someuser: has joined #ruby
[06:42:02] matthewd: Or StringValuePtr + StringValueLen if it could contain \0
[06:42:34] andikr: has joined #ruby
[06:46:03] Nobun: YEAH. Finally worked
[06:46:15] Nobun: StringValueCStr(v) works very fine
[06:46:27] Nobun: this is the final (working) code:
[06:47:15] Nobun: c++ code: http://dpaste.com/0FVF7GZ
[06:48:07] sleetdrop: has joined #ruby
[06:48:15] Nobun: ruby code (test.rb): http://dpaste.com/2M2MH83
[06:48:26] Coming: has joined #ruby
[06:50:20] Nobun: now I will work in the actual application... last question
[06:50:25] ur5us: has joined #ruby
[06:50:46] astrobunny: has joined #ruby
[06:50:54] Nobun: In my application I will need to run two scripts with this same method, and all of them will use this CoreVxa to communicate with application
[06:50:55] Defenestrate: has joined #ruby
[06:51:22] Nobun: is it good if I will add this CoreVxa class this way to both script?
[06:53:14] waveprop: has left #ruby: ()
[06:53:19] harfangk: has joined #ruby
[06:53:21] howdoi: has joined #ruby
[06:54:19] wutschkef: has joined #ruby
[06:55:49] ferr: has joined #ruby
[06:56:12] __Yiota: has joined #ruby
[07:00:33] mark_66: has joined #ruby
[07:01:35] ta: has joined #ruby
[07:02:25] rahul_bajaj: has joined #ruby
[07:05:05] bronson: has joined #ruby
[07:06:30] burgestrand: has joined #ruby
[07:08:02] claudiuinberlin: has joined #ruby
[07:08:45] rabajaj: has joined #ruby
[07:10:01] wutschkef: has joined #ruby
[07:12:03] _aeris_: has joined #ruby
[07:15:17] nofxx: has joined #ruby
[07:16:12] uZiel: has joined #ruby
[07:16:41] Guest97372: has joined #ruby
[07:16:55] alex``: has joined #ruby
[07:17:40] ramfjord: has joined #ruby
[07:17:51] enterprisey: has joined #ruby
[07:21:57] kliq: has joined #ruby
[07:25:45] wutschkef: has joined #ruby
[07:31:43] bigkevmcd: has joined #ruby
[07:32:32] ahrs: has joined #ruby
[07:41:31] wutschkef: has joined #ruby
[07:41:50] bigkevmcd: has joined #ruby
[07:48:57] claudiuinberlin: has joined #ruby
[07:49:55] Guest97372: has joined #ruby
[07:50:35] aufi: has joined #ruby
[07:53:04] marcux: has joined #ruby
[07:53:32] rrichardsr3: has joined #ruby
[07:54:58] personofinterest: has joined #ruby
[07:57:19] wutschkef: has joined #ruby
[07:59:01] sysvalve: has joined #ruby
[07:59:41] nicolai86: has joined #ruby
[08:02:34] cschneid_: has joined #ruby
[08:05:46] bronson: has joined #ruby
[08:06:23] Cohedrin_: has joined #ruby
[08:07:07] aufi_: has joined #ruby
[08:08:44] nicolai86: has joined #ruby
[08:09:54] jenrzzz: has joined #ruby
[08:09:55] jenrzzz: has joined #ruby
[08:11:02] guille-moe: has joined #ruby
[08:12:03] dminuoso_: has joined #ruby
[08:13:05] wutschkef: has joined #ruby
[08:14:41] personofinterest: so i have an array with several items in it. when i call that array with a loop and push it to a defined method the array value is encapsulated in ["$arrayvalue"]. i've tried to strip it and chomp it but no luck. any ideas?
[08:15:39] elomatreb: You should show your code, that sounds a little vague
[08:16:47] nicolai86_: has joined #ruby
[08:16:52] mim1k: has joined #ruby
[08:18:05] rrichardsr3: has joined #ruby
[08:18:35] uZiel: has joined #ruby
[08:19:46] personofinterest: https://pastebin.com/47ZJUiBc
[08:19:48] ruby[bot]: personofinterest: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/614986280ca3d8c548398da812867dd7
[08:19:48] ruby[bot]: personofinterest: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[08:20:20] Beams: has joined #ruby
[08:20:20] personofinterest: okay so https://gist.github.com/614986280ca3d8c548398da812867dd7
[08:20:52] personofinterest: error: /usr/lib/ruby/2.3.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): http://["google.com"]/test (URI::InvalidURIError)
[08:23:03] elomatreb: You're splatting with the * in the args, it would contain all arguments given to the method but the last
[08:23:18] elomatreb: You only have one, so it's a one-element array. Remove the *
[08:24:45] redondos: has joined #ruby
[08:25:40] personofinterest: it's working :D any recommendations to boost speed? i'm new to ruby.
[08:26:24] elomatreb: If you're interacting with a website, your script is most likely not the bottleneck
[08:27:11] jenrzzz: has joined #ruby
[08:27:11] jenrzzz: has joined #ruby
[08:28:32] stoffus: has joined #ruby
[08:28:50] wutschkef: has joined #ruby
[08:29:13] Silthias1: has joined #ruby
[08:32:37] Beams: has joined #ruby
[08:43:37] marr: has joined #ruby
[08:44:37] wutschkef: has joined #ruby
[08:47:43] astrobunny: has joined #ruby
[08:52:33] Beams: has joined #ruby
[08:53:14] goyox86_: has joined #ruby
[08:54:49] paranoicsan: has joined #ruby
[08:55:18] lxsameer: has joined #ruby
[08:57:22] aspiers: has joined #ruby
[08:57:37] Beams: has joined #ruby
[09:00:24] wutschkef: has joined #ruby
[09:00:41] claudiuinberlin: has joined #ruby
[09:02:15] claudiuinberlin: has joined #ruby
[09:04:03] kassav_: has joined #ruby
[09:04:13] charliesome: has joined #ruby
[09:05:57] simmaniac: has joined #ruby
[09:06:01] hogetaro: has joined #ruby
[09:07:09] tvw: has joined #ruby
[09:08:05] quobo: has joined #ruby
[09:08:39] dminuoso_: has joined #ruby
[09:10:50] sysvalve: has joined #ruby
[09:13:54] claudiuinberlin: has joined #ruby
[09:16:11] wutschkef: has joined #ruby
[09:17:01] simmaniac: has joined #ruby
[09:17:44] ramfjord: has joined #ruby
[09:19:37] kassav__: has joined #ruby
[09:21:30] ams__: has joined #ruby
[09:26:59] aufi_: has joined #ruby
[09:29:37] drbrain: has joined #ruby
[09:29:38] drbrain: has joined #ruby
[09:31:57] wutschkef: has joined #ruby
[09:33:23] charliesome: has joined #ruby
[09:34:51] cschneid_: has joined #ruby
[09:37:51] waveprop: has joined #ruby
[09:41:41] waveprop: do i still need to read the pixake book before POODR if i did the codecademy course?
[09:42:06] drbrain: has joined #ruby
[09:42:06] drbrain: has joined #ruby
[09:44:04] kliq: has joined #ruby
[09:45:03] hgost: has joined #ruby
[09:45:10] Silthias: has joined #ruby
[09:46:43] bruno-: has joined #ruby
[09:47:43] wutschkef: has joined #ruby
[09:50:35] mtkd: has joined #ruby
[09:52:47] TomyLobo: has joined #ruby
[09:52:57] cschneid_: has joined #ruby
[09:58:10] rgr: has joined #ruby
[09:58:45] blackmesa: has joined #ruby
[09:58:46] charliesome: has joined #ruby
[10:03:30] wutschkef: has joined #ruby
[10:04:17] Beams: has joined #ruby
[10:05:51] rgr_: has joined #ruby
[10:06:36] bronson: has joined #ruby
[10:07:36] blackmesa1: has joined #ruby
[10:09:47] alex``: has joined #ruby
[10:16:05] rahul_bajaj: has joined #ruby
[10:16:30] blackmesa1: has joined #ruby
[10:16:56] ldepandis: has joined #ruby
[10:17:23] dionysus69: has joined #ruby
[10:19:20] wutschkef: has joined #ruby
[10:19:52] blackmesa1: has joined #ruby
[10:20:53] dinfuehr: has joined #ruby
[10:23:29] bkxd: has joined #ruby
[10:26:59] mark_66: has joined #ruby
[10:28:39] naprimer: has joined #ruby
[10:29:34] GodFather: has joined #ruby
[10:31:03] mattp_: has joined #ruby
[10:32:10] maleghast: has joined #ruby
[10:33:08] wutschkef: has joined #ruby
[10:33:49] cschneid_: has joined #ruby
[10:40:28] kassav_: has joined #ruby
[10:44:13] Mon_Ouie: has joined #ruby
[10:45:06] FahmeF: has joined #ruby
[10:50:27] Silthias1: has joined #ruby
[10:52:59] guardianx: has joined #ruby
[10:54:27] Seenox: has joined #ruby
[10:54:29] apparition: has joined #ruby
[11:06:25] apparition: has joined #ruby
[11:11:33] Coming_: has joined #ruby
[11:12:23] guardianx: has joined #ruby
[11:17:59] ramfjord: has joined #ruby
[11:18:22] drbrain: has joined #ruby
[11:18:22] drbrain: has joined #ruby
[11:25:11] marr: has joined #ruby
[11:29:42] claudiuinberlin: has joined #ruby
[11:35:17] cschneid_: has joined #ruby
[11:38:01] ldnunes: has joined #ruby
[11:39:58] Defenestrate: has joined #ruby
[11:40:28] leah2: oO ruby 2.5 wants to reverse backtraces?
[11:40:45] Defenestrate: has joined #ruby
[11:46:01] Defenestrate: has joined #ruby
[11:47:37] dminuoso_: leah2: Yes.
[11:48:03] dminuoso_: leah2: And it's quite sensible. Often you end up with quite long backtraces, and it's most useful to the see the most recent stack frame immediately, rather than always being required to scroll.
[11:48:04] leah2: of all things to steal from python, why this :P
[11:48:18] leah2: i want to see the last output and then the error...
[11:48:42] dminuoso_: leah2: You still get that. ;-)
[11:49:02] leah2: i see the output and dozen lines of stacktrace and then the error?
[11:49:25] dminuoso_: Ah I see what you mean. From what I can see you can still get the old behavior back though.
[11:49:32] leah2: yeah, i guess
[11:49:58] synthroid: has joined #ruby
[11:51:40] dminuoso_: Hash#transform_keys is sexy, I've been doing that in numerous applications.
[11:51:42] synthroid: has joined #ruby
[11:52:21] dminuoso_: obj = obj.transform_keys(&toInternal) that looks just right.
[11:52:35] cschneid_: has joined #ruby
[11:52:41] tbuehlmann: to_internal?
[11:53:09] dminuoso_: tbuehlmann: Hah no, poor naming on my side I guess.
[11:53:42] tbuehlmann: javascript-land I assume
[11:54:31] cttttt: has joined #ruby
[11:54:32] dminuoso_: How long will you be making fun of me for enjoying JavaScript? :(
[11:57:33] shinnya: has joined #ruby
[11:58:57] charliesome: has joined #ruby
[12:01:53] fyrril: has joined #ruby
[12:07:19] Beams: has joined #ruby
[12:07:41] bronson: has joined #ruby
[12:09:43] mostlybadfly: has joined #ruby
[12:15:50] kliq: has joined #ruby
[12:20:39] Nahra`: has joined #ruby
[12:21:13] dionysus69: has joined #ruby
[12:29:19] theRoUS: has joined #ruby
[12:29:33] bmurt: has joined #ruby
[12:34:19] friday: has joined #ruby
[12:38:41] noizex: I encountered some terrible coding that causes a bug when running aggregate sum() on a collection
[12:38:57] dminuoso_: noizex: Do you have a testcase?
[12:40:53] noizex: here is your test case: [19] pry(main)> [BigDecimal('1.0'), BigDecimal('2.0'), ''].sum
[12:40:54] noizex: TypeError: String can't be coerced into BigDecimal
[12:42:06] noizex: assuming I can't easily modify the attribute that in some cases is equal '' what would be second best solution? filtering that out? collection can have several thousands entries
[12:42:18] bmurt: has joined #ruby
[12:48:41] johno84: has joined #ruby
[12:53:25] dminuoso_: noizex: The cleanest way would be to have a predicate lambda isEmpty/isNotEmpty
[12:53:52] dminuoso_: ary.filter(&:isNotEmpty).sum
[12:53:57] dminuoso_: ary.filter(&isNotEmpty).sum
[12:54:05] bmurt: has joined #ruby
[12:54:09] dminuoso_: Or ary.reject(&isEmpty).sum
[12:54:42] dminuoso_: Or don't let it happen in the first place.
[12:56:17] charliesome: has joined #ruby
[12:57:31] dminuoso_: noizex: https://eval.in/877208
[12:57:35] kassav_: has joined #ruby
[12:57:37] dminuoso_: Is what I probably might do.
[12:57:54] noizex: yeah that makes sense
[12:58:15] noizex: unfortunately not allowing this to happen touches some other legacy code and I'm not much into touching it
[12:58:33] noizex: despite it being completly wrong, no consistency at all, total is total not freaking ''
[12:58:42] noizex: I will just sanitize this collection then as you suggested
[12:58:44] dminuoso_: Then I suggest the isNumeric approach.
[12:59:46] noizex: tough there is one problem, I showed example with simple array
[13:00:13] Beams: has joined #ruby
[13:00:18] noizex: in reality, it's an attribute and it's dynamically resolved by using coll.sum(&attr_string_name.to_s)
[13:00:50] ramfjord: has joined #ruby
[13:01:47] dminuoso_: noizex: My suggestion is: dont have a one-trick-pony function like that.
[13:02:09] dminuoso_: Transform in multiple steps (and screw performance until profiling tells you to do differently)
[13:02:49] dminuoso_: collection.map(&func).select(&predicate).sum
[13:03:38] dminuoso_: Or better than sum
[13:03:42] dminuoso_: collection.map(&func).select(&predicate).inject(&:+)
[13:03:47] dminuoso_: collection.map(&func).select(&predicate).reduce(&:+)
[13:03:50] guymanndude: has joined #ruby
[13:04:15] bash_n00b: has joined #ruby
[13:04:27] bash_n00b: I'm trying to write a ruby script
[13:04:38] bash_n00b: i'm requiring 'json'
[13:04:48] dminuoso_: noizex: But I have a highly FP approach to ruby these days.
[13:04:51] bash_n00b: but I get an error saying ./parser.rb:3:in `require': no such file to load -- rubygems (LoadError) from ./parser.rb:3
[13:05:01] bash_n00b: how can I import the json module into my ruby script?
[13:05:14] dminuoso_: bash_n00b: what ruby version are you running?
[13:05:39] bash_n00b: dminuoso_: ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
[13:07:00] dminuoso_: bash_n00b: You have a rather old ruby version (which at the time did not ship with JSON out of the box).
[13:07:23] dminuoso_: bash_n00b: Either install the json gem (which means you also need to require 'rubygems' in your project), but it's probably much better to upgrade to modern Ruby such as 2.4.2.
[13:07:49] bash_n00b: dminuoso_: ok
[13:08:21] guymanndude: Hi, I've developed a Ruby gem. I want to specify that it requires Ruby v2.0 or above. I know how to do this in my .gemspec file, however I'm wondering if there is a convention for showing this in the project's README
[13:08:57] mson: has joined #ruby
[13:09:15] guymanndude: like, in my *Install* section, can I just have a bulletpoint or line that says "Requires Ruby 2 or above" ?
[13:09:18] guymanndude: or is there a better way
[13:09:25] yeticry_: has joined #ruby
[13:09:43] dminuoso_: guymanndude: There's no real convention wrt that. Personally I would not list any dependencies that are already covered in gemspecs
[13:09:53] guymanndude: ok thanks dminuoso_
[13:10:18] guymanndude: wrt updating the gemspec with ' spec.required_ruby_version = ">= 2.0.0"
[13:10:30] guymanndude: do I need to bump up the version on the minor gem then?
[13:10:35] guymanndude: minor version*
[13:11:01] dminuoso_: guymanndude: That ruby version is highly likely to be too open.
[13:11:24] cschneid_: has joined #ruby
[13:11:39] conta: has joined #ruby
[13:11:41] dminuoso_: guymanndude: Ruby has a tendency to break things across minor releases.
[13:12:04] guymanndude: dminuoso_: it's because YAML.safe_load isn't available to Ruby less than v2
[13:12:11] chouhoulis: has joined #ruby
[13:12:22] dminuoso_: guymanndude: Yes, but can you promise that it will be compatible to ruby 2.5, 2.6, 2.7, 2.8, an so forth?
[13:12:44] guymanndude: I don't imagine Ruby would remove YAML.safe_load in those later versions...at least I hope not
[13:13:01] dminuoso_: guymanndude: Ah actually its probably fine.
[13:13:05] dminuoso_: Go for it. :)
[13:13:11] dminuoso_: https://github.com/rails/rails/blob/master/rails.gemspec
[13:13:23] dminuoso_: https://github.com/sinatra/sinatra/blob/master/sinatra.gemspec
[13:14:18] im0nde: has joined #ruby
[13:14:23] dminuoso_: https://github.com/bundler/bundler/blob/master/bundler.gemspec
[13:14:29] dminuoso_: Seems like a lot of projects do it like that.
[13:14:33] guymanndude: so should I bump up the minor version of my gem with this small update dminuoso_ ?
[13:15:26] claudiuinberlin: has joined #ruby
[13:15:42] dminuoso_: guymanndude: SemVer has you covered.
[13:16:35] dminuoso_: guymanndude: As far as I can tell, according to SemVer a minor version bump is sufficient.
[13:16:37] guymanndude: I tried reading thru this, but it's not clear http://guides.rubygems.org/patterns/#semantic-versioning
[13:16:50] guymanndude: like it's not really a new feature per se
[13:17:02] dminuoso_: Though you could argue its not exactly backwards compatible
[13:17:17] dminuoso_: But its not an API change.
[13:17:30] guymanndude: idk. I guess I'll just ask my team in the PR. thanks tho
[13:17:41] dminuoso_: guymanndude: SemVer focuses on how stable the API is.
[13:18:00] ldnunes: has joined #ruby
[13:18:50] yeticry: has joined #ruby
[13:18:52] dminuoso_: If I use library XYZ, and I update its minor version, it should not require me to change my code that uses the same library.
[13:20:18] rprimus: has joined #ruby
[13:21:11] rfoust: has joined #ruby
[13:22:46] cdg: has joined #ruby
[13:23:36] DLSteve_: has joined #ruby
[13:26:55] millerti: has joined #ruby
[13:27:06] bruno-: has joined #ruby
[13:27:16] guille-moe1: has joined #ruby
[13:29:04] cschneid_: has joined #ruby
[13:29:15] pagios: has joined #ruby
[13:29:47] pagios: has left #ruby: ()
[13:30:06] xco: has joined #ruby
[13:34:41] sppp: has joined #ruby
[13:34:47] fmcgeough: has joined #ruby
[13:35:00] xco: i don’t know much about regexes. but this is what i want to do. i want to extract the user ID 981650945 from “http://0.0.0.0:3000/admin/users/981650945/books_read”. so far the only thing i tried is string[/\d+/] and i’m getting “0”, not what i want. string = “http://0.0.0.0:3000/admin/users/981650945/books_read”
[13:35:25] dminuoso_: xco: Do you want the quick and dirty solution, or the proper solution?
[13:35:44] xco: i want both please (for learning purposes)
[13:35:57] xco: then i can compare and think around it
[13:37:09] dminuoso_: xco: Use URI.parse, the resulting object has a #path method, which you can then split using '/'
[13:37:15] bmurt: has joined #ruby
[13:37:37] dminuoso_: Then you have a clean way of lensing into the value you want, without any silly regular expressions.
[13:38:04] jordanm: has joined #ruby
[13:38:04] dminuoso_: (Or you can use a regular expression against the #path)
[13:39:33] xco: dminuoso_: i don’t want to use URI
[13:39:48] Swat2: has joined #ruby
[13:40:04] dminuoso_: xco: %r{users/(\d+)/books_read} ?
[13:40:39] jjaii9: has joined #ruby
[13:40:40] dminuoso_: xco: %r{/admin/users/(\d+)/books_read} perhaps might be a bit cleaner
[13:41:37] dminuoso_: xco: %r{/admin/users/(?<user_id>\d+)/books_read} if you want a named capture
[13:41:51] xco: i want the numbers only out of the string
[13:41:54] elsevero: has joined #ruby
[13:41:55] dminuoso_: That's what this does.
[13:41:56] cschneid_: has joined #ruby
[13:42:34] lexruee: has joined #ruby
[13:43:21] xco: how do i use it again my string variable?
[13:44:17] dminuoso_: xco: You could technically use #[] and then use magic variables, or better use .match and then use the resulting match object.
[13:44:24] sepp2k: has joined #ruby
[13:45:06] Swat2: can someone guide me in the right direction of comparing two arrays of hashes ~28k in size. [{id: <int>, code: <int>, imglength: <int>}...] I need to know, what is different between ArrayA and ArrayB (Whats in B that isn't in A, What's in A that isn't in B, or if just the imglength has changed..)
[13:46:08] dminuoso_: xco: https://eval.in/877259
[13:46:26] dminuoso_: xco: Im a big fan of using named captures, but you can also use unnamed captures (which are then referred to by position).
[13:46:29] ptx0: has joined #ruby
[13:46:50] rabajaj: has joined #ruby
[13:46:55] dminuoso_: swat2: a - b, b - a
[13:47:43] dminuoso_: That last condition is a bit annoying.
[13:48:25] Swat2: dminuoso_: i must be doing something wrong, I've tried that and it doesnt seem to yield the results i'm expecting
[13:49:23] Swat2: dminuoso_: the order of the arrays wont always be the same
[13:49:32] dminuoso_: swat2: #- does not care about the order of arrays.
[13:49:54] dminuoso_: swat2: #- gives you the complement of two arrays (treating them as sets)
[13:49:57] Derperperd: has joined #ruby
[13:50:33] wutschkef: has joined #ruby
[13:50:42] dminuoso_: *gah. Difference
[13:51:06] dminuoso_: So A - B is mathematically equivalent to A \ B.
[13:51:33] Swat2: i'll check my dataset
[13:51:58] griffindy: has joined #ruby
[13:53:26] Swat2: >.< ... looks like I went full retard :(
[13:53:57] dminuoso_: swat2: Do you care about the position in the array at all?
[13:53:58] Swat2: my .map used wrong field :(
[13:54:35] Swat2: dminuoso_: nope I don't.. its to Queue images that have changed in size
[13:54:47] dminuoso_: swat2: Consider using Set instead of Array then.
[13:55:33] dminuoso_: Though keep in mind that a set cant have duplicates.
[13:55:38] Swat2: writing something for my friend to pull images out of his ERP system which stores them in MSSQL, and Uploads them to his website against his shopping cart software
[13:57:24] Swat2: I wrote it for him years ago using PHP scripts, but new version of software and shopping cart, different structure, felt like i wanted to give it a birthday and write in ruby as a learning experience for me too
[13:57:47] Swat2: Not really looked into Set's... will google that
[13:59:52] im0nde_: has joined #ruby
[14:03:54] ferr1: has joined #ruby
[14:04:07] Swat2: dminuoso_: so are you suggesting I could just do arraya.to_set ?
[14:04:30] dminuoso_: swat2: naah, I wouldn't generate an array to begin with :p
[14:04:31] Swat2: and the same w/ arrayb and then compare them thatway ?
[14:04:49] dminuoso_: Or just ignore it and use arrays away.
[14:07:52] Swat2: so instead of using a .map, on my Model I could just do ProductImageMap.all.to_set
[14:08:13] polishdub: has joined #ruby
[14:08:20] amirite: has joined #ruby
[14:08:52] bronson: has joined #ruby
[14:08:55] cschneid_: has joined #ruby
[14:08:56] jrafanie: has joined #ruby
[14:09:16] jobewan: has joined #ruby
[14:10:27] eaxxae: has joined #ruby
[14:10:47] simmaniac: has joined #ruby
[14:10:54] dminuoso_: swat2: There's little point to coerce an array to set unless you wanted the special behavior that set gives you.
[14:12:36] Swat2: wise words, I'm coercing the data into an array of hashes by means of a .map to get the data in a way it can be compared
[14:13:16] Swat2: so if using Set is a better option that's more flexible, then I'm all ear..err eyes
[14:13:56] Rapture: has joined #ruby
[14:14:57] eaxxae: has joined #ruby
[14:17:49] claudiuinberlin: has joined #ruby
[14:22:42] tcopeland: has joined #ruby
[14:23:55] wutschkef: has joined #ruby
[14:26:23] rfoust: has joined #ruby
[14:26:38] cschneid_: has joined #ruby
[14:29:32] claudiuinberlin: has joined #ruby
[14:30:59] Swat2: dminuoso_: Thank you. With your asurance that I was on the right track, I've found and fixed the two errors in my code. hope you have a great day/night :)
[14:34:47] cdg: has joined #ruby
[14:38:19] sysvalve: has joined #ruby
[14:39:10] FrostCandy: has joined #ruby
[14:40:15] __Yiota: has joined #ruby
[14:40:27] kculpis: has joined #ruby
[14:41:44] kculpis: has joined #ruby
[14:42:03] amirite: has joined #ruby
[14:42:45] Cohedrin_: has joined #ruby
[14:43:06] kculpis: has joined #ruby
[14:45:44] cschneid_: has joined #ruby
[14:46:13] naftilos76: has joined #ruby
[14:47:43] jrafanie: has joined #ruby
[14:48:34] claudiuinberlin: has joined #ruby
[14:48:39] dminuoso_: has joined #ruby
[14:49:09] wutschkef: has joined #ruby
[14:49:55] jjaii9: has joined #ruby
[14:50:16] Beams: has joined #ruby
[14:50:29] pygospa: has joined #ruby
[14:51:01] cschneid_: has joined #ruby
[14:51:54] jinie: has joined #ruby
[14:52:06] jrafanie: has joined #ruby
[14:55:42] orbyt_: has joined #ruby
[14:56:50] gusrub: has joined #ruby
[15:01:53] gil_: has joined #ruby
[15:03:49] enko: has joined #ruby
[15:04:45] FastJack: has joined #ruby
[15:05:32] InfinityFye: has joined #ruby
[15:05:36] ych: has joined #ruby
[15:06:12] rippa: has joined #ruby
[15:06:47] shekhspear: has joined #ruby
[15:09:12] aupadhye: has joined #ruby
[15:12:14] bkxd: has joined #ruby
[15:12:52] shekhspear: has joined #ruby
[15:15:03] ElDoggo: has joined #ruby
[15:15:56] cadillac__: has joined #ruby
[15:17:38] blackmesa1: has joined #ruby
[15:18:21] wald0: has joined #ruby
[15:18:50] wald0: !a = 0.00009885 ; p a
[15:18:52] blackmesa: has joined #ruby
[15:19:02] wald0: a -> 9.885e-05 (wtf?)
[15:19:21] wald0: why my float is not 0.00009885 but this strange value instead?
[15:22:41] cdg: has joined #ruby
[15:23:06] cdg: has joined #ruby
[15:25:42] havenwood: wald0: It's a notation that means the same number.
[15:25:43] cdg_: has joined #ruby
[15:26:24] havenwood: >> '%.8f' % 0.00009885
[15:26:25] ruby[bot]: havenwood: # => "0.00009885" (https://eval.in/877335)
[15:29:03] jjaii9: has joined #ruby
[15:29:36] wald0: havenwood: so how i can use/convert it to the "real" value? i want to use that variable to say 0.000098 not a different thing
[15:30:20] havenwood: wald0: You want it to look a certain way in your REPL?
[15:30:35] havenwood: wald0: Or what do you mean?
[15:30:43] graft: has joined #ruby
[15:30:43] graft: has joined #ruby
[15:30:54] wutschkef: has joined #ruby
[15:31:43] wald0: im trying to write a bot that needs to put a value to the API of a website, this value is actually 0.9885e-05, but i want it to be 0.00009885
[15:34:27] cagomez: has joined #ruby
[15:39:37] wald0: mmh, maybe converting it to a string...
[15:39:56] synthroid: has joined #ruby
[15:40:51] wald0: ACTION cries
[15:41:37] havenwood: wald0: did you see my Kernel#sprintf (%) example above?
[15:41:59] wald0: yes but i dont se how to use it here
[15:42:14] wald0: i did some tests without success, its always converted to that strange thing
[15:42:30] adaedra: with the % ?
[15:42:53] adaedra: the strange thing is the scientific notation :o)
[15:43:54] adaedra: 9.885 x 10^-5
[15:43:56] wald0: well, im not sure how the api of the website will interpret scientific notations :/
[15:44:32] adaedra: that's where havenwood's proposition with % should help you
[15:45:28] wald0: ah! i was able to use it now
[15:45:41] wald0: sems like it cannot be saved? i need to always use it in the moment that i want to use it? :/
[15:45:54] adaedra: how do you try to assign it?
[15:46:00] DenSchub: has joined #ruby
[15:46:56] wald0: a function (class) returns the result.to_f
[15:47:03] wald0: so my variable = calling that function
[15:47:50] adaedra: that saves the Float value, you have to use % in your assignation if you want to keep the formatted string
[15:49:18] wald0: var = '%.8f' % function(param) --> String can't be coerced tinto Float
[15:49:55] selim: has joined #ruby
[15:49:59] adaedra: Looks like you're already returning a String object
[15:51:17] wald0: doens't looks like, i have: return result["arr_entry"].to_f
[15:51:59] adaedra: TIL JSON accepts scientific notation
[15:52:06] adaedra: Well, inspect the value to be sure
[15:58:36] wald0: well, seems like there happened an operation with these values without trigger an error
[16:01:32] marxarelli: has joined #ruby
[16:04:14] troys: has joined #ruby
[16:07:14] fChanX: has joined #ruby
[16:07:22] orbyt_: has joined #ruby
[16:07:34] fChanX: Can anyone vouch for "https://learnrubythehardway.org/book/"?
[16:08:03] [Butch]: has joined #ruby
[16:08:31] Nahra: has joined #ruby
[16:09:41] bronson: has joined #ruby
[16:11:16] rrichardsr3: has joined #ruby
[16:11:18] wald0: well, i just want to send the correct parameter via the website API
[16:11:34] wald0: oops sorry, just answering something in the wrong scrolling level :)
[16:12:08] mtkd: has joined #ruby
[16:15:37] havenwood: fChanX: It's not idiomatic Ruby. It seems to intentionally be Ruby from a Python perspective.
[16:16:02] havenwood: fChanX: I'd suggest Learn to Program by Chris Pine if you don't know other langs or Well-Grounded Rubyist if you do.
[16:16:18] ShalokShalom_: has joined #ruby
[16:17:01] havenwood: >> wald0 Use BigDecimal
[16:17:02] ruby[bot]: havenwood: # => uninitialized constant BigDecimal (NameError) ...check link for more (https://eval.in/877359)
[16:17:32] pygospa: has joined #ruby
[16:17:46] havenwood: >> require 'bigdecimal'; require 'bigdecimal/util'; 0.000098858.to_d.to_digits # wald0
[16:17:47] ruby[bot]: havenwood: # => "0.000098858" (https://eval.in/877360)
[16:17:51] dminuoso: has joined #ruby
[16:19:34] fChanX: Thanks havenwood!
[16:20:03] adlerdias: has joined #ruby
[16:20:19] synthroid: has joined #ruby
[16:20:34] adlerdias: has left #ruby: ()
[16:22:46] dminuoso_: has joined #ruby
[16:28:38] elcontrastador: has joined #ruby
[16:31:03] jjaii9: has joined #ruby
[16:31:42] MrBusiness3: has joined #ruby
[16:31:59] marr: has joined #ruby
[16:36:52] wutschkef: has joined #ruby
[16:38:18] blackmesa: has joined #ruby
[16:39:40] ramfjord: has joined #ruby
[16:40:07] uZiel: has joined #ruby
[16:44:55] conta: has joined #ruby
[16:48:02] Mekkis: has joined #ruby
[16:48:15] wutschkef: has joined #ruby
[16:50:46] cagomez: why use a private attr_reader? I just notice that it allows us to access a variable using `foo` instead of `@foo`. am I glossing over some semantics/context?
[16:50:46] Danny: has joined #ruby
[16:51:51] kahra: has joined #ruby
[16:52:35] fChanX: The book "Well-Grounded Rubyist" is good.
[16:52:46] dionysus69: has joined #ruby
[16:54:59] bmurt: has joined #ruby
[16:55:14] Guest6096: has left #ruby: ()
[16:55:26] alfiemax: has joined #ruby
[16:56:04] dminuoso_: fChanX: Yes it quite is.
[16:56:12] dminuoso_: I keep recommending it, but I've never read it.
[16:56:27] dminuoso_: ACTION pokes a hole into baweaver 
[16:56:48] Danny1: has joined #ruby
[16:57:04] DTZUZO: has joined #ruby
[16:57:42] wutschkef: has joined #ruby
[17:00:02] adaedra: Please stop making holes in our operators, dminuoso_.
[17:00:06] fChanX: I would do the same lol
[17:00:29] Mon_Ouie: has joined #ruby
[17:00:43] ahrs: has joined #ruby
[17:01:13] shekhspear: has joined #ruby
[17:02:30] thinkpad: has joined #ruby
[17:02:48] shekhspear: has joined #ruby
[17:05:50] havenwood: ruby-install --latest ruby-2.5.0-preview1 # \o/
[17:06:18] dminuoso_: havenwood: if you survive, let me know.
[17:06:23] Dimik: has joined #ruby
[17:06:25] dminuoso_: If you dont, can I have your stuff?
[17:06:29] havenwood: ACTION deploys to prod
[17:06:56] wutschkef: has joined #ruby
[17:07:15] havenwood: rvm get head && rvm install ruby-2.5.0-preview1
[17:07:18] amirite: has joined #ruby
[17:07:39] ElDoggo: has joined #ruby
[17:07:49] postmodern: has joined #ruby
[17:08:27] havenwood: rbenv install ruby-2.5.0-preview1 # after updating ruby-build, however you do that
[17:09:02] havenwood: https://www.ruby-lang.org/en/news/2017/10/10/ruby-2-5-0-preview1-released/
[17:10:34] havenwood: PS: If you haven't already: gem update --system # http://blog.rubygems.org/2017/10/09/unsafe-object-deserialization-vulnerability.html
[17:13:28] jenrzzz: has joined #ruby
[17:16:25] havenwood: 42.yield_self(&:itself) #=> 42
[17:16:27] havenwood: 42.yield_self.first #=> 42
[17:17:19] uZiel: has joined #ruby
[17:18:10] raynold: has joined #ruby
[17:19:50] bkxd: has joined #ruby
[17:20:58] ta: has joined #ruby
[17:21:24] [Butch]: has joined #ruby
[17:22:38] ta: has joined #ruby
[17:22:53] Danny1_: has joined #ruby
[17:24:01] fChanX: has left #ruby: ()
[17:25:21] dminuoso_: havenwood: that reminds me
[17:25:40] cagomez: has joined #ruby
[17:25:44] dminuoso_: I wanted to implement Proc#to_yaml and Proc.from_yaml
[17:25:49] Danny1_: has joined #ruby
[17:25:51] cagomez: has joined #ruby
[17:25:54] dminuoso_: What could possibly go wrong.
[17:26:34] havenwood: dminuoso_: DId you see the Ruby Quiz along those lines?: http://rubyquiz.com/quiz38.html
[17:26:40] dminuoso_: havenwood: yield_self as a poor-mans |> ?
[17:26:48] dminuoso_: That reads so... horrible.
[17:26:54] d10n-work: has joined #ruby
[17:27:07] dminuoso_: havenwood: Yes, but Im adressing it the proper way.
[17:27:17] dminuoso_: RubyVM::InstructionSequence is my bread and butter.
[17:27:43] dminuoso_: Currently devising a method of plugging in digitally signing the proc.
[17:27:55] dminuoso_: (So that it's actually safe to to_yaml/from_yaml)
[17:28:36] dminuoso_: havenwood: waaaait. yield_self is destructive?
[17:28:39] dminuoso_: how freaking annoying is that.
[17:29:30] dminuoso_: Oh it doesn't - it helps if you can read.
[17:29:57] hahuang65: has joined #ruby
[17:30:43] ramfjord: has joined #ruby
[17:30:50] Guest97372: has joined #ruby
[17:31:38] shekhspear: has joined #ruby
[17:31:50] havenwood: >> require 'json'; require 'objspace'; JSON.load ObjectSpace.dump ->{}
[17:31:52] ruby[bot]: havenwood: # => {"address"=>"0x40be3da0", "type"=>"DATA", "class"=>"0x40a5ebc4", "struct"=>"proc", "references"=>["0 ...check link for more (https://eval.in/877462)
[17:34:13] havenwood: dminuoso_: clearly we need an ObjectSpace.load
[17:35:04] dminuoso_: havenwood: Using ObjectSpace.load we could implement the "swipe" action you see folks on the series "24", when somebody says "Give me your terminal", and they just swipe it across screens.
[17:36:48] Authenticator: has joined #ruby
[17:37:28] claudiuinberlin: has joined #ruby
[17:38:54] jenrzzz: has joined #ruby
[17:39:09] chouhoulis: has joined #ruby
[17:41:23] claudiuinberlin: has joined #ruby
[17:41:43] ahrs: has joined #ruby
[17:41:48] rprimus: has joined #ruby
[17:43:12] synthroid: has joined #ruby
[17:43:25] uZiel: has joined #ruby
[17:43:34] postmodern: just double checking that this isn't a bug. Specifying the search: or ndots: options with Resolv::DNS.new causes it to stop returning any records. https://gist.github.com/postmodern/4a649d679dbde8dff6a3278dac7f18b0
[17:44:04] jrafanie: has joined #ruby
[17:46:19] simmaniac: has joined #ruby
[17:46:21] alfiemax: has joined #ruby
[17:47:51] eckhardt: has joined #ruby
[17:50:50] havenwood: postmodern: Seems it only works if you supply :nameserver, :search *and* :ndots.
[17:51:13] havenwood: Resolv::DNS.new(nameserver: '8.8.8.8', search: %w[.], ndots: 1).getaddresses('twitter.com') #=> [#<Resolv::IPv4 104.244.42.1>, #<Resolv::IPv4 104.244.42.129>]
[17:51:54] havenwood: "Must contain :nameserver, :search and :ndots keys."
[17:53:13] postmodern: ahh that's odd
[17:54:38] Cohedrin_: has joined #ruby
[17:55:37] Kang0: has joined #ruby
[17:55:47] Kang0: which projects you are working with
[17:56:37] AndBobsYourUncle: has joined #ruby
[17:56:52] DTZUZO: has joined #ruby
[17:57:58] jenrzzz: has joined #ruby
[17:57:58] jenrzzz: has joined #ruby
[17:59:04] weaksauce: has joined #ruby
[17:59:28] orbyt_: has joined #ruby
[18:01:14] bmurt: has joined #ruby
[18:02:36] Danny1: has joined #ruby
[18:02:53] Danny1: has joined #ruby
[18:05:11] Guest97372: has joined #ruby
[18:07:41] AxelAlex: has joined #ruby
[18:08:19] imode: has joined #ruby
[18:10:03] ledestin: has joined #ruby
[18:10:50] bronson: has joined #ruby
[18:11:15] jamesaxl: has joined #ruby
[18:11:30] jenrzzz: has joined #ruby
[18:11:30] jenrzzz: has joined #ruby
[18:12:04] kahra: has joined #ruby
[18:13:12] kahra: has joined #ruby
[18:14:20] jamesaxl: has joined #ruby
[18:16:47] wutschkef: has joined #ruby
[18:17:13] mtkd: has joined #ruby
[18:17:28] claudiuinberlin: has joined #ruby
[18:17:31] faces: has joined #ruby
[18:17:56] jamesaxl: has joined #ruby
[18:21:04] kriskropd: has joined #ruby
[18:21:04] kriskropd: has joined #ruby
[18:21:19] uZiel: has joined #ruby
[18:21:45] amirite: has joined #ruby
[18:25:40] Ikri: has joined #ruby
[18:25:46] dionysus70: has joined #ruby
[18:28:13] lexruee: has joined #ruby
[18:32:12] synthroid: has joined #ruby
[18:32:41] mkaito: has joined #ruby
[18:35:25] charliesome: has joined #ruby
[18:37:03] johno84: has joined #ruby
[18:37:07] uZiel: has joined #ruby
[18:37:16] minimalism: has joined #ruby
[18:38:02] cdg: has joined #ruby
[18:41:57] jamesaxl: has joined #ruby
[18:43:11] eroux: has joined #ruby
[18:45:08] ur5us: has joined #ruby
[18:45:27] chrisgop_: has joined #ruby
[18:48:45] chrisgop_: has left #ruby: ()
[18:50:23] blackmesa: has joined #ruby
[18:50:38] jenrzzz: has joined #ruby
[18:50:38] jenrzzz: has joined #ruby
[18:50:52] swills: has joined #ruby
[18:52:24] eaxxae: has joined #ruby
[18:52:25] kriskropd: has joined #ruby
[18:52:26] jrafanie: has joined #ruby
[18:56:03] emulator4: has joined #ruby
[18:57:24] sagax: has joined #ruby
[18:57:29] MarkBilk__: has joined #ruby
[18:58:39] bkxd: has joined #ruby
[19:04:22] synthroid: has joined #ruby
[19:06:36] mr_sourcerer: has joined #ruby
[19:09:02] cschneid_: has joined #ruby
[19:13:56] alfiemax: has joined #ruby
[19:16:28] jphase: has joined #ruby
[19:26:53] FastJack: has joined #ruby
[19:27:21] goyox86_: has joined #ruby
[19:34:24] shekhspear: has joined #ruby
[19:36:44] wutschke1: has joined #ruby
[19:38:28] gusrub: has joined #ruby
[19:39:17] ltem: has joined #ruby
[19:40:38] Inside: has joined #ruby
[19:41:33] rabajaj: has joined #ruby
[19:42:03] synthroid: has joined #ruby
[19:42:55] orbyt_: has joined #ruby
[19:46:04] shekhspear: has joined #ruby
[19:50:01] shinnya: has joined #ruby
[19:50:25] emulator3: has joined #ruby
[19:50:39] fmccann: has joined #ruby
[19:52:45] hahuang65: has joined #ruby
[19:55:25] jrafanie: has joined #ruby
[19:56:01] irated: Does cephfs do write-behind by default
[19:56:41] fmccann_: has joined #ruby
[19:57:40] havenwood: irated: cephfs?
[19:59:35] cdg: has joined #ruby
[20:01:00] ur5us: has joined #ruby
[20:01:44] baweaver: Ceph Filesystem
[20:01:46] goyox86_: has joined #ruby
[20:01:56] baweaver: Though I don't know how that relates to Ruby
[20:02:22] SuperTaz: has joined #ruby
[20:02:23] cdg_: has joined #ruby
[20:02:51] baweaver: It'd probably be a better question to ask on their support channels irated
[20:03:24] naitian: has joined #ruby
[20:07:40] eroux: has joined #ruby
[20:08:10] eckhardt: has joined #ruby
[20:08:36] kies: has joined #ruby
[20:09:48] SuperTaz: has joined #ruby
[20:11:45] bronson: has joined #ruby
[20:12:11] gheegh: has joined #ruby
[20:12:14] dminuoso: baweaver, do you know what relates to ruby?
[20:14:37] serhart: has joined #ruby
[20:15:29] dminuoso: https://gist.github.com/norc/9bbfa8fbcbc267121f457ea3e70637d9
[20:18:09] irated: wrong chat
[20:18:12] irated: sorry guys
[20:18:28] irated: to many irc channels open
[20:20:16] baweaver: Not a problem mate
[20:22:33] fmccann: has joined #ruby
[20:22:39] fmccann_: has joined #ruby
[20:22:45] elsevero: has joined #ruby
[20:22:45] Kanibal: dman[m]: is that some sort of perl code (?)
[20:24:34] jrafanie_: has joined #ruby
[20:25:59] synthroid: has joined #ruby
[20:27:02] snath: has joined #ruby
[20:27:26] snath: has left #ruby: ()
[20:28:21] kliq: has joined #ruby
[20:28:29] sunrunner20: has joined #ruby
[20:30:19] nowhere_man: has joined #ruby
[20:32:15] mtkd: has joined #ruby
[20:33:26] jrafanie: has joined #ruby
[20:38:40] dminuoso: Kanibal, much better.
[20:39:19] dminuoso: Kanibal, it's Befunge.
[20:39:54] Kanibal: I guess it's the Ackermann function !1 (ofc I didn't just Google that, who'd do that!)
[20:40:24] zeroDivisible: Folks, just wondering - I'm getting random IOErrors when writing to socket when talking to redis. Suspecting something on the OS level. How could I approach debugging this? Would you have any hints maybe?
[20:41:01] zeroDivisible: *IOError (closed stream)
[20:41:04] matthewd: zeroDivisible: What exactly are the errors, and what's your ruby version?
[20:41:45] matthewd: If it's 2.4.1 or 2.3.4, try upgrading to the latest point release
[20:41:47] zeroDivisible: Ruby 2.1.1, when using Redis Ruby gem. It mostly works ok, but very rarely I'm getting IOError, which I can't explain - and there's nothing in Redis server logs.
[20:42:02] zeroDivisible: *2.1.10 - can't use newer sadly :(
[20:42:21] Ishido: has joined #ruby
[20:42:50] matthewd: Hmm.. I'm not sure whether that version has the bug I'm thinking of. I would've guessed it was too old, but maybe not.
[20:43:10] dminuoso: zeroDivisible, are you in a multithreaded environment?
[20:43:47] dminuoso: zeroDivisible, and what's the underlying redis-rb gem version?
[20:44:32] zeroDivisible: re: multithreaded - very much so. Not a webapp but a bit complex multithreaded / multiprocess job framework (mostly grown in house). 3.3.3 is the version of the redis-rb gem.
[20:44:51] zeroDivisible: I'm basically trying to understand how I can approach debugging this as my knowledge isn't the greatest in that area.
[20:46:17] wutschkef: has joined #ruby
[20:48:42] gheegh: has joined #ruby
[20:49:27] dminuoso: I wonder whether this is related to https://github.com/rails/rails/issues/10989
[20:49:37] dminuoso: matthewd seems to have re-opened this issue, he ought to know more about this.
[20:51:33] jhass: has joined #ruby
[20:52:53] arup_r: has joined #ruby
[20:53:01] mtkd: has joined #ruby
[20:53:17] arup_r: Does https://ruby-doc.org/stdlib-2.3.0/libdoc/securerandom/rdoc/SecureRandom.html#module-SecureRandom-label-Examples SecureRandom.base64 method creates always urlsafe string?
[20:54:19] matthewd: I don't think that involved IOErrors -- in fact, I think IOErrors were the *solution* to that problem
[20:55:53] dminuoso: matthewd, yes precisely. If that solution is to throw IOErrors...
[20:56:21] dminuoso: matthewd, I've seen numerous guides all pointing at casually catching IOError everywhere just in case the connection was cut
[20:56:49] dminuoso: Maybe I just got my head twisted, I don't know.
[20:58:50] matthewd: zeroDivisible: I wouldn't imagine your OS is lying to you (though then again, if you're stuck on an old unsupported ruby, who knows what your surrounding environment looks like)
[20:59:13] matthewd: zeroDivisible: I would think the more probable explanations are that the connection really has gone away, or ruby's confused
[21:01:53] matthewd: 2.1.10 was released at the same time as 2.2.7, which definitely has a bug that manifests in this way ("ruby's confused") -- so it's fairly possible it did get the same backport
[21:04:10] zeroDivisible: matthewd: Makes sense. I was wondering whether something on the OS level could be causing those issues, but the rest of the env is relatively up to date. I'll try poking around a bit here, our current appraoch is to just catch those errors, fully disconnect and reconnect. It works, it just feels bad :/ Will at least try to strace to see how sockets are getting closed / open.
[21:05:09] dminuoso: zeroDivisible, it
[21:05:12] dminuoso: it's possible but unlikely
[21:05:32] zeroDivisible: matthewd: would you have a reference to the bug somehwere handy? I'll google if not.
[21:08:58] jhass: has joined #ruby
[21:09:13] Cohedrin_: has joined #ruby
[21:09:27] blackmesa: has joined #ruby
[21:09:44] bvcosta: has joined #ruby
[21:09:45] ramfjord: has joined #ruby
[21:15:52] ramfjord: has joined #ruby
[21:19:03] mim1k: has joined #ruby
[21:19:13] SuperLag: has joined #ruby
[21:21:02] matthewd: zeroDivisible: One thing to try would be downgrading to 2.1.8
[21:21:15] matthewd: (though I don't know what other fixes you'd be giving up by doing so)
[21:21:36] Derperperd: has joined #ruby
[21:21:51] matthewd: zeroDivisible: https://bugs.ruby-lang.org/issues/13632 is the bug I'm thinking of
[21:22:36] lxsameer: has joined #ruby
[21:23:20] matthewd: But that blames https://bugs.ruby-lang.org/issues/13076, which only seems to have been backported as far as 2.2
[21:24:14] pygospa: has joined #ruby
[21:27:40] MrBusiness: has joined #ruby
[21:28:42] herbmillerjr: has joined #ruby
[21:28:55] roshanavand: has joined #ruby
[21:31:00] Defenestrate: has joined #ruby
[21:32:22] amirite: has joined #ruby
[21:38:18] enterprisey: has joined #ruby
[21:46:14] goyox86_: has joined #ruby
[21:54:55] weaksauce: has joined #ruby
[21:55:35] gheegh: has joined #ruby
[21:55:51] minimalism: has joined #ruby
[22:12:50] bronson: has joined #ruby
[22:17:17] jphase: has joined #ruby
[22:20:55] fmcgeough: has joined #ruby
[22:23:17] AxelAlex: has joined #ruby
[22:28:18] SeepingN: has joined #ruby
[22:29:19] konsolebox: has joined #ruby
[22:33:13] Azure: has joined #ruby
[22:33:47] QualityAddict: has joined #ruby
[22:36:39] amirite: has joined #ruby
[22:37:56] marcux: has joined #ruby
[22:38:01] Ropeney: has joined #ruby
[22:38:04] zeroDivisible: matthewd: thank you for this. I'll try to dig deeper there.
[22:42:40] matthewd: zeroDivisible: If you can artificially reproduce the problem, maybe you can test with a newer ruby, even if you can't deploy / run your full app on it
[22:49:47] wutschkef: has joined #ruby
[22:50:14] jenrzzz: has joined #ruby
[22:53:52] goyox86: has joined #ruby
[22:57:50] TomyLobo: has joined #ruby
[23:04:44] mson: has joined #ruby
[23:05:10] workmad3: has joined #ruby
[23:05:29] thinkpad: has joined #ruby
[23:07:27] n35xdxb0: has joined #ruby
[23:11:10] tcopeland: has joined #ruby
[23:12:37] mynameisdebian: has joined #ruby
[23:17:39] goyox86_: has joined #ruby
[23:18:01] mynameisdebian: I was trying to install Rails on a server that has Ruby 2.0.0 installed. It told me, "Rails requires Ruby version something", so I researched the issue and found that I am supposed to install Rails 4.2. In attempting to do so I am now being told that Nokogiri requires Ruby 2.1. I know it's sort of a "thing" with Ruby that there never be a way to set things up without resolving multiple issues, but is there maybe a way to
[23:18:01] mynameisdebian: install Rails and have it resolve the dependencies itself, or to know what version I am supposed to install? I'm pretty sure people were using Rails under Ruby 2.0.0. It seems incredibly unsophisticated that the installer that knows my version of Ruby is too low for Rails should also know before even starting that it is also too low for Nokogiri. Does anyone know how I can get a Rails environment installed without fuss?
[23:18:08] elsevero: has joined #ruby
[23:19:57] mynameisdebian: Unfortunately I'm more into writing programs and web apps than I am into learning Ruby internals. I would have thought a language designed to be easy would not be difficult to install? Unfortunately that is almost never the case. How does a Rails developer set up a dev environment?
[23:20:11] cagomez: has joined #ruby
[23:20:45] baweaver: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
[23:21:46] mynameisdebian: unfortunately I cannot go above Rails 2.0.0
[23:21:48] baweaver: Ruby 2.0 is also multiple years old and long since out of band for support.
[23:22:03] mynameisdebian: well, that's what Amazon EC2 supports on their Amazon Linux AMI
[23:22:30] mynameisdebian: I don't believe I can upgrade.
[23:23:04] baweaver: You have shell access to EC2 instances to run things like Chef and friends, or really even a bash script in initscript
[23:23:18] baweaver: or just bake a new AMI to deploy from so you don't have to bother with that
[23:23:22] mynameisdebian: So, what is the command? I tried "yum install ruby -y" and it told me I have the latest version
[23:23:30] AndBobsYourUncle: has joined #ruby
[23:23:41] baweaver: but that may be a bit beyond you starting out
[23:23:42] baweaver: See that link up there?
[23:24:31] baweaver: Ubuntu is based on Debian which is close enough to CoreOS which is based on CentOS that that guide should work.
[23:25:04] baweaver: Short version: your problem is Redhat blows at keeping things up to date, and that trickles down from RHEL6 -> CentOS -> CoreOS (EC2 AMI Base)
[23:25:05] imode: has joined #ruby
[23:25:19] baweaver: Well, maybe not 6. I think 6 was 1.8.6
[23:25:41] baweaver: Then you _really_ would have had some fun there
[23:25:44] agent_white: has joined #ruby
[23:27:04] naprimer2: has joined #ruby
[23:27:06] havenwood: mynameisdebian: This isn't particularly Ruby-related, but don't use Amazon Linux.
[23:27:10] mynameisdebian: I could wipe out Amazon's default install of Ruby and start over with RVM or something like that, but my whole thing here was to get a development environment up and running quick. I chose the Amazon AMI because it included Ruby. I guess I'm mostly confused that it's so hard to simply install Rails with what I already have. I have Ruby 2.0.0 which Rails supports. It should be easy to get Rails running on it
[23:27:23] havenwood: mynameisdebian: Why are you using Amazon Linux?
[23:28:10] baweaver: In general use the newest version of things available, not necessarily what your OS has in its packages (packages are out of date most of the time)
[23:28:28] havenwood: mynameisdebian: Amazon Linux doesn't include many nice, up-to-date packages nor does it have the stability of intentionally-ancient CentOS.
[23:28:30] mynameisdebian: havenwood: simply because it had Ruby already installed. I would normally use Debian but I thought I was being clever using Amazon's features and that installing Rails would be a breeze.
[23:28:40] baweaver: Ruby 2.0.0 has been EOL for years now.
[23:28:43] havenwood: mynameisdebian: Fedora or Archlinux will treat you better.
[23:29:06] havenwood: mynameisdebian: They have solid installs of modern Ruby.
[23:29:17] havenwood: And install gems for the local user by default.
[23:29:34] havenwood: Or even OpenSUSE, there are lots of options.
[23:29:44] havenwood: I'd recommend avoiding Amazon Linux.
[23:29:51] jenrzzz: has joined #ruby
[23:29:51] jenrzzz: has joined #ruby
[23:29:59] baweaver: havenwood: went and scared them off
[23:30:13] havenwood: ACTION puts on softer gloves
[23:30:15] baweaver: in general I agree though, CoreOS is crappy
[23:30:15] mynameisdebian: has joined #ruby
[23:30:17] mynameisdebian: I'm not sure if I'm just ranting here.. It just seems really strange that a command which would have installed Rails back when Ruby 2.0.0 was not EOL would not give me all kinds of problems. It seems like the Rails installer has some "logic" to it, yet never produces the obvious result
[23:30:47] mynameisdebian: I guess it's more complicated than that
[23:30:47] havenwood: mynameisdebian: Ruby 2.0 is past end-of-life. Use an operating system that supports modern packages if you want to use modern libraries.
[23:30:56] baweaver: The more removed by time a version is the more likely you get random nonsense like that.
[23:31:11] havenwood: mynameisdebian: Use a supported version of Ruby!
[23:31:20] mynameisdebian: okay, so Fedora or Arch then. Not Arch?
[23:31:27] mynameisdebian: I mean, "Not Debian"?
[23:31:32] matthewd: Debian should be fine
[23:31:43] Ropeney: Def don't suggest you be using Arch
[23:32:10] baweaver: ACTION doesn't think the distro matters
[23:32:20] baweaver: All package managers kinda suck at keeping things modern
[23:32:21] havenwood: mynameisdebian: Debian has a fine Ruby. It's setup for a system install, but you can always install Ruby yourself.
[23:32:22] matthewd: Anything with a currently-supported ruby available is fine
[23:32:34] baweaver: RHEL being one of the worst
[23:32:41] baweaver: and anything that descends from it
[23:32:54] matthewd: baweaver: Well, RHEL has a separate thing for more recent ruby etc
[23:32:57] mynameisdebian: Thanks guys, I think that helps
[23:33:06] havenwood: Ropeney: I'd strongly suggest Arch over Amazon Linux.
[23:33:10] havenwood: Pick your poison.
[23:33:36] mynameisdebian: want to mention that I've used Arch and appreciated never once having a package not work exactly as expected
[23:33:38] matthewd: mynameisdebian: However, for a development environment, a non-system ruby is generally the recommendation
[23:33:41] Ropeney: I'd take into account the current difficulties and not suggest an even more difficult distro as an alternative :)
[23:33:44] Ropeney: my opinion either way
[23:33:45] havenwood: FreeBSD has a nice, modern Ruby.
[23:33:48] Ropeney: we all have them
[23:33:50] mynameisdebian: what does "non-system ruby" mean?
[23:33:55] havenwood: OpenBSD! \o/
[23:33:58] baweaver: install from source
[23:34:07] havenwood: Jeremy Evens actually maintains the OpenBSD Ruby afaik.
[23:34:12] matthewd: Basically: RVM, rbenv, or chruby
[23:34:16] baweaver: or rbenv or whatever else
[23:34:19] mynameisdebian: system ruby is what the package manager installs then?
[23:34:23] Ropeney: *cough* docker *cough*
[23:34:27] amirite: has joined #ruby
[23:34:49] mynameisdebian: I would prefer to use Docker for the experience, if I wasn't so desperate to get my environment up
[23:34:49] havenwood: mynameisdebian: Typically, yes.
[23:35:19] goyox86___: has joined #ruby
[23:35:27] mynameisdebian: BTW you guys are all pretty nice compared to some other channels
[23:35:45] Ropeney: mynameisdebian https://blog.codeship.com/running-rails-development-environment-docker/ takes a few minutes and GG
[23:36:22] mynameisdebian: Ropeney: bookmarked :)
[23:36:56] jenrzzz: has joined #ruby
[23:36:56] jenrzzz: has joined #ruby
[23:37:13] __Yiota: has joined #ruby
[23:37:27] n35xdxb0: has joined #ruby
[23:42:54] jenrzzz: has joined #ruby
[23:42:54] jenrzzz: has joined #ruby
[23:43:53] gheegh: has joined #ruby
[23:47:02] wald0: "order = function.new_order(args)", the variable order should be an array with multiple values, if i use "order << function.new_order(args)", another entry will be added to the array? so i can access to the multiple added orders as p order[1]["value"] ?
[23:47:49] goyox86___: has joined #ruby
[23:48:02] enterprisey: has joined #ruby
[23:49:42] baweaver: wald0: what now? That's a pretty dense sentance.
[23:49:54] baweaver: << is basically pushing something into an array
[23:50:02] baweaver: = is setting something equal to something else
[23:52:50] amirite: has joined #ruby
[23:53:52] knight33: has joined #ruby
[23:56:35] cschneid_: has joined #ruby
[23:58:36] goyox86: has joined #ruby
[23:59:55] mynameisdebian: I got Debian installed. Tried to run rbenv (which for some reason only has up to 2.2.0) to install 2.2.0 and it tells me something like, "BUILD FAILED: clean up the tree" or something like that. For some reason Debian 8 (the AMI) only supports 2.1.5 in the repo. I'm really at a loss here. I know it's a longshot, but does anyone here use Debian with Ruby on EC2?