« Back to channel list

#ruby - 11 June 2018

« Back 1 day Forward 1 day »
[00:03:19] apeiros: has joined #ruby
[00:03:27] jrafanie: has joined #ruby
[00:17:54] kmurphy4: has joined #ruby
[00:19:35] kmurphy4: has joined #ruby
[00:22:17] Azure: has joined #ruby
[00:33:59] BlopMonster: has joined #ruby
[00:40:01] chamar: has joined #ruby
[00:45:46] sytherax: has joined #ruby
[00:51:39] ur5us: has joined #ruby
[00:56:30] orbyt_: has joined #ruby
[00:58:53] Es0teric: has joined #ruby
[01:11:48] sytherax: has joined #ruby
[01:35:32] thadtheman: has joined #ruby
[01:35:58] thadtheman: Does any one know if there is a way for gem simple_install to install a scecific branch of a gem?
[01:39:49] BlopMonster: has joined #ruby
[01:42:14] andrewray: has joined #ruby
[01:42:50] neohunter: has joined #ruby
[01:46:55] Azure|dc: has joined #ruby
[01:56:51] tty: has joined #ruby
[02:10:18] konsolebox: has joined #ruby
[02:12:25] coffeecu_: has joined #ruby
[02:34:05] nythalcrow: has joined #ruby
[02:38:08] coffeecupp__: has joined #ruby
[02:40:33] amar: has joined #ruby
[02:50:56] nicht: has joined #ruby
[02:51:25] nicht: has joined #ruby
[02:57:35] akaiiro: has joined #ruby
[03:00:10] cadillac_: has joined #ruby
[03:05:23] henoc: how can I use this project? https://github.com/taskrabbit/makara
[03:06:15] Zarthus: it looks like it has a README.md.
[03:06:22] Zarthus: There's even a header "basic usage"
[03:08:28] coffeecupp__: has joined #ruby
[03:09:32] braincrash: has joined #ruby
[03:19:03] ciscam: has joined #ruby
[03:33:18] gix-: has joined #ruby
[03:44:44] BlopMonster: has joined #ruby
[03:50:58] coffeecupp__: has joined #ruby
[04:06:38] ciscam: has joined #ruby
[04:28:13] psprint: has joined #ruby
[04:40:51] Immune: has joined #ruby
[04:41:04] Immune: has left #ruby: ()
[04:41:14] sytherax: has joined #ruby
[05:08:42] darkhanb: has joined #ruby
[05:11:45] Es0teric: has joined #ruby
[05:24:34] ur5us: has joined #ruby
[05:46:36] shinnya: has joined #ruby
[05:52:40] andrewray: has joined #ruby
[05:52:47] aupadhye: has joined #ruby
[05:53:51] reber: has joined #ruby
[05:54:28] dminuoso: arne: You should use SizedQueue. This STM is about the most naive implementation I've seen.
[05:58:47] yxhuvud: has joined #ruby
[06:06:39] pskosinski: has joined #ruby
[06:06:40] conta: has joined #ruby
[06:09:29] armando: has joined #ruby
[06:17:51] kapil___: has joined #ruby
[06:18:56] biberu: has joined #ruby
[06:19:03] dionysus69: has joined #ruby
[06:26:15] havenwood: wkoszek: If I recall, I was saying Ruby can be statically linked against dependencies instead of dynamically linked. That's what RVM and Travis, etc, do when they ship "precompiled" Ruby.
[06:27:30] snickers: has joined #ruby
[06:28:21] havenwood: An aside, but Ruby Packer is a fairly new tool that's pretty nifty: https://github.com/pmq20/ruby-packer
[06:34:56] havenwood: wkoszek: There's also Traveling Ruby: https://phusion.github.io/traveling-ruby/
[06:40:01] amar: has joined #ruby
[06:47:20] andikr: has joined #ruby
[06:48:03] za1b1tsu: has joined #ruby
[06:55:30] clemens3_: has joined #ruby
[07:00:28] mjolnird: has joined #ruby
[07:02:33] yohji: has joined #ruby
[07:03:28] saTchymoto: has joined #ruby
[07:03:53] cgfbee: has joined #ruby
[07:04:43] sysvalve: has joined #ruby
[07:05:10] TomyWork: has joined #ruby
[07:16:23] cadillac_: has joined #ruby
[07:20:12] amar: has joined #ruby
[07:24:07] Es0teric: has joined #ruby
[07:24:08] Sembei: has joined #ruby
[07:26:39] yohji: has joined #ruby
[07:29:38] amar: has joined #ruby
[07:30:35] clemens3: has joined #ruby
[07:37:51] elomatreb: has joined #ruby
[07:39:15] amar: has joined #ruby
[07:41:15] psprint: has left #ruby: ("WeeChat 2.1")
[07:45:42] BlopMonster: has joined #ruby
[07:45:47] zmo: has joined #ruby
[07:47:03] mikecmpbll: has joined #ruby
[07:51:02] venmx: has joined #ruby
[07:54:13] conta: has joined #ruby
[07:56:42] vondruch: has joined #ruby
[07:57:12] mikecmpbll: has joined #ruby
[08:01:06] ellcs: has joined #ruby
[08:07:00] schleppel: has joined #ruby
[08:11:02] amar: has joined #ruby
[08:11:43] amar: has joined #ruby
[08:13:12] burgestrand: has joined #ruby
[08:16:40] Beams: has joined #ruby
[08:33:25] rippa: has joined #ruby
[08:34:20] xuyuheng: has joined #ruby
[08:38:03] braindead_: has joined #ruby
[08:38:04] ren0v0: has joined #ruby
[08:39:59] chat: has joined #ruby
[08:43:50] archedice: has joined #ruby
[08:44:03] nibbo: has joined #ruby
[08:49:17] soniya29: has joined #ruby
[08:52:01] arne: uhm, when i do something like
[08:52:21] arne: class Test;some_method;def some_method;"hello";end;end
[08:52:24] Paraxial: has joined #ruby
[08:52:32] arne: it works, why is that exactly, does ruby honor definitions first?
[08:53:30] apeiros: has joined #ruby
[08:54:33] arne: asm>> class Test;some_method;def some_method;"hello";end;end
[08:54:41] Bish: asm>> class Test;some_method;def some_method;"hello";end;end
[08:54:43] ruby[bot]: Bish: I have disassembled your code, the result is at https://eval.in/1018658
[08:55:48] elomatreb: arahael: I don't think that works? some_method should be undefined in that scope (since it's an instance method=
[08:56:08] elomatreb: Bish: ^ (sorry)
[08:56:24] Bish: elomatreb: well i have code running like this
[08:56:30] Bish: and i expected it to break
[08:56:40] Bish: then it didn't, i would like to understand hwy it doesn't
[08:57:07] Bish: i mean ruby has some oddities, which are good to know
[08:57:30] elomatreb: That example like that throws an error, it might be more useful if you do share your actual code
[08:57:57] Bish: hm, right it does..
[08:58:04] Bish: but it doesn.t seem to do it in production
[08:58:06] Bish: im confused
[08:58:27] elomatreb: Is there some metaprogramming/method_missing stuff going on?
[08:58:32] herbmillerjr: has joined #ruby
[08:58:49] Bish: une seconde, i will just share my code
[08:59:32] tbuehlmann: is this rails?
[09:00:13] _yohji_: has joined #ruby
[09:01:33] elomatreb: To answer your original question: Ruby does not hoist definitions
[09:02:28] Bish: yeah i figure
[09:12:13] apeiros: Bish: place a `method(:some_method).source_location` in front of the call (and if its in prod, log the result away)
[09:12:45] Beams: has joined #ruby
[09:16:16] TomyWork: has joined #ruby
[09:18:26] Bish: apeiros: nono, i guess it's just a fuckup on my part
[09:18:30] Bish: i mean, it can't be that it works
[09:18:39] Bish: i will just place the call behind the definition
[09:19:03] venmx: has joined #ruby
[09:19:26] ur5us: has joined #ruby
[09:19:55] jottr: has joined #ruby
[09:21:54] coffeecupp__: has joined #ruby
[09:26:02] Mia: has joined #ruby
[09:26:02] Mia: has joined #ruby
[09:31:05] plexigras: has joined #ruby
[09:33:38] NL3limin4t0r: has joined #ruby
[09:33:59] herbmillerjr: has joined #ruby
[09:34:44] NL3limin4t0r: Does Ruby have destruction assignment for hashes?
[09:35:58] FernandoBasso: has joined #ruby
[09:38:25] dreamthese: has joined #ruby
[09:38:41] elomatreb: destructuring? Not for hashes, no.
[09:39:28] Bish: you could write something like that, i guess
[09:39:32] dminuoso: NL3limin4t0r: you can fake it with values_at
[09:40:01] dminuoso: >> hash = {a:1, b:2, c:3}; a, b = hash.values_at(:a, :b)
[09:40:02] ruby[bot]: dminuoso: # => [1, 2] (https://eval.in/1018670)
[09:40:04] Bish: ohyeah, does ruby have deconstruction?
[09:40:38] dminuoso: NL3limin4t0r: and you can splat onto methods
[09:41:20] Bish: does hash use values_at when using []?
[09:41:39] elomatreb: Bish: For arrays, yes: `a, b = [1, 2]` (and you can nest)
[09:41:39] herbmillerjr: has joined #ruby
[09:42:04] dminuoso: It should be using to_ary
[09:42:12] dminuoso: asm>> a, b = [1,2]
[09:42:12] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/1018674
[09:42:21] dminuoso: oh that looks magical
[09:42:24] dminuoso: asm>> a, b = c
[09:42:27] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/1018677
[09:42:57] Bish: how do i get the C code to the method with pry?
[09:43:19] dminuoso: Bish: you need pry-doc
[09:43:28] dminuoso: Bish: then you can use `show-source`
[09:44:50] Bish: i read the code of pry recently, fun stuff with the piping to less etc
[09:45:13] dminuoso: Bish: especially when you ^C while in the pager
[09:45:26] dr3wo: has joined #ruby
[09:45:31] Bish: is it what breaks the thing?
[09:45:49] dminuoso: It's at least one way. But you can `stty echo/stty sane` it bacjk
[09:46:11] Bish: good to know, happens quite often to me, but not because of ctrl-c
[09:46:41] Bish: working on a "eierlegende-wollmichsau"-project where i want to do the same
[09:46:50] lxsameer: has joined #ruby
[09:46:51] Bish: but with remote processes via ssh & docker
[09:47:09] elomatreb: I read that as "Eier-Legende" (egg legend)
[09:47:30] Bish: elomatreb: do you know what it means though :D?
[09:47:54] elomatreb: yeah, and my one is spelled wrong :)
[09:47:58] NL3limin4t0r: ty for the answers. Too bad destructing hashes isn't in Ruby yet, but I can move on for now.
[09:48:06] Bish: elomatreb: but you aren't german?
[09:48:20] Bish: NL3limin4t0r: it's not in there yet, it likely never will
[09:49:51] NL3limin4t0r: Bish: You'll never know for sure. Keyword arguments got also added later on.
[09:50:14] Bish: that's a whole different thing entirely, i mean what is hash deconstructing anyways?
[09:50:24] za1b1tsu: has joined #ruby
[09:50:26] Bish: some sort of callback the gets invoked if something isn't connected to the hash anymore?
[09:51:12] NL3limin4t0r: Something like `{label:} = {id: 1, label: 'item label'}` seems plausible (same syntax as keyword arguments).
[09:51:16] Bish: when i google hash destruturing i just find marihuana recipes
[09:51:32] za1b1tsu: hello anyone using rubymine?
[09:51:39] Bish: NL3limin4t0r: oh, i totally got you wrong
[09:52:05] Bish: yeah something like that may come, i like how javascript es6 did that
[09:52:17] Bish: sometimes i wish ruby had it too, yes
[09:53:00] Bish: i guess you could write a method that does something like that
[09:54:06] NL3limin4t0r: I'm good for now though, I was just wondering if it was in Core.
[09:54:08] Bish: well not really.
[09:54:27] elomatreb: It's basically the toned-down imperative version of pattern matching from functional languages
[09:55:05] Bish: isn't everything a toned-down imperative version of something in functional language
[09:55:31] elomatreb: (mmmh the words lined up)
[09:56:00] Bish: can you do something like.. have a callback in a binding, that gets called when a lvar get's referenced/used?
[09:56:16] Bish: i guess then you could do what he wants with
[09:56:23] Bish: magic_hash ( [a,b,c] )
[09:56:26] za1b1tsu: I'm trying out IDEs to see what I'm missing with vim, but is this: https://i.imgur.com/cSl355G.png
[09:56:28] elomatreb: That's lazy evaluation, another thing from functional languages :P
[09:59:22] Bish: huh, i think i found a bug in pry
[09:59:40] Bish: _file_ is hash.c for me (i guess because i read the show-src of Hash.new.values_at"
[10:00:18] chmurifree: has joined #ruby
[10:05:30] herbmillerjr: has joined #ruby
[10:07:19] nfk: has joined #ruby
[10:09:22] NL3limin4t0r: za1b1tsu: Yep 🙋
[10:13:44] ellcs: has joined #ruby
[10:17:19] za1b1tsu: it's not just session[. it does not find session
[10:17:26] za1b1tsu: had to go in terminal with grep :D
[10:19:46] Zaab1t: has joined #ruby
[10:19:49] rabajaj: has joined #ruby
[10:24:13] BlopMonster: has joined #ruby
[10:24:15] apparition: has joined #ruby
[10:24:56] ur5us_: has joined #ruby
[10:26:11] rabajaj_: has joined #ruby
[10:27:10] ur5us: has joined #ruby
[10:28:19] NL3limin4t0r: za1b1tsu: Try Ctrl+Shift+F
[10:29:28] NL3limin4t0r: Shift+Shift is just for finding filenames or classes
[10:31:37] NL3limin4t0r: The navigation shortcuts I'll use most are Ctrl+N for navigating classes, Ctrl+Shift+N for navigating plain file names and Ctrl+Shift+F to find content of files in the whole project.
[10:39:13] jottr: has joined #ruby
[10:48:47] AJA4350: has joined #ruby
[10:54:16] donofrio: has joined #ruby
[10:56:19] RougeR: has joined #ruby
[11:00:30] jrafanie: has joined #ruby
[11:02:25] ciscam: has joined #ruby
[11:02:52] workmad3: has joined #ruby
[11:07:47] yxhuvud: has joined #ruby
[11:12:17] micutzu: has joined #ruby
[11:12:35] jottr: has joined #ruby
[11:18:27] kt: has joined #ruby
[11:21:22] za1b1tsu: has joined #ruby
[11:25:07] patteh: has joined #ruby
[11:25:34] gigetoo: has joined #ruby
[11:26:43] ur5us: has joined #ruby
[11:29:17] sleetdrop: has joined #ruby
[11:34:21] patteh: has joined #ruby
[11:39:38] Aleeious: has joined #ruby
[11:40:45] xuyuheng: has joined #ruby
[11:41:00] Aleeious: has joined #ruby
[11:41:34] cyberg: has joined #ruby
[11:42:18] Aleeious: https://metaruby.com/t/want-to-learn-ruby/1739/1
[11:46:25] fmcgeough: has joined #ruby
[11:52:29] jamesaxl: has joined #ruby
[11:53:24] kt: has joined #ruby
[12:04:08] Aleeious: has joined #ruby
[12:05:18] Aleeious: has joined #ruby
[12:09:54] amatas: has joined #ruby
[12:14:38] beefjoe: has joined #ruby
[12:14:47] amatas: has joined #ruby
[12:16:45] vondruch: has joined #ruby
[12:22:03] xuyuheng: has joined #ruby
[12:30:08] Megamos: has joined #ruby
[12:31:42] kliq: has joined #ruby
[12:33:23] loveablelobster: has joined #ruby
[12:33:49] Megamosaren: has joined #ruby
[12:34:44] cliq: has joined #ruby
[12:39:22] kliq: has joined #ruby
[12:43:50] xuyuheng: has joined #ruby
[12:51:23] conta: has joined #ruby
[12:55:38] bmurt: has joined #ruby
[12:57:28] gigetoo: has joined #ruby
[13:00:04] jcalla: has joined #ruby
[13:00:32] kapil___: has joined #ruby
[13:03:27] jottr: has joined #ruby
[13:04:37] conta: has joined #ruby
[13:05:44] synthroid: has joined #ruby
[13:12:54] Es0teric: has joined #ruby
[13:13:26] GodFather: has joined #ruby
[13:13:35] Megamos: has joined #ruby
[13:14:44] karapetyan: has joined #ruby
[13:14:49] jottr: has joined #ruby
[13:21:00] jcalla: has joined #ruby
[13:21:57] tAn: has joined #ruby
[13:24:24] kt: has joined #ruby
[13:24:26] Eising: If I have a string that ends with a \r\n, am I right to suspect that this will not be matched by regex '$'?
[13:25:11] heftig: eising: the \r is a problem, yes
[13:25:25] Eising: looks like I have to .chomp then
[13:25:53] heftig: .chomp("\r\n")
[13:26:25] heftig: ah, nvm, bare .chomp does recognize \r\n
[13:27:09] cyberg: has joined #ruby
[13:34:39] braindead_: scrooloose, also with the path its not working
[13:35:24] scrooloose: braindead_: what is the error?
[13:35:36] braindead_: bundle not found
[13:36:02] braindead_: if i ssh in the path, can i check the bundle there somehow?
[13:36:19] braindead_: if i just type bundle exec ruby script/mail_new_activity something should happen, right?
[13:37:12] braindead_: because there is no feedback at all
[13:37:25] braindead_: no error but no success either
[13:42:23] scrooloose: braindead_: Yeah you should be able to ssh in and run the command and then sub in the full path to bundler for cron
[13:43:03] amatas: has joined #ruby
[13:43:19] scrooloose: so the crontab entry command will be something like `cd /path/to/app/dir && /path/to/bundle exec the-command`
[13:44:20] Rapture: has joined #ruby
[13:44:51] braindead_: i tried this, but its the same result. bundle not found
[13:44:52] braindead_: cd /var/www/vhosts/domain/httpdocs && env RAILS_ENV=production sh -c '/var/www/vhosts/domain/httpdocs/bundle exec ruby script/mail_new_activity; /var/www/vhosts/domain/httpdocs/bundle exec ruby script/post_to_twitter'
[13:46:21] face: has joined #ruby
[13:47:41] braindead_: but bundle is not a folder.. do i need to make a space between the path and bundle?
[13:47:51] dminuoso: The uglifyify transform removes development imports. Make it global too (-g).
[13:48:43] scrooloose: braindead_: what does `which bundle` return?
[13:49:48] braindead_: i did it like this now and no errors returned
[13:49:49] braindead_: cd /var/www/vhosts/domain/httpdocs && env RAILS_ENV=production sh -c 'cd /var/www/vhosts/domain/httpdocs bundle exec ruby script/mail_new_activity; cd /var/www/vhosts/domain/httpdocs bundle exec ruby script/post_to_twitter'
[13:50:12] mikecmpbll: has joined #ruby
[13:51:27] kt: has joined #ruby
[13:51:56] k0mpa: has joined #ruby
[13:52:02] scrooloose: I guess 2/3rds of those `cd /var/www/...httpdocs` commands are redundant?
[13:52:11] micutzu: has joined #ruby
[13:54:46] braindead_: it dont returns anything because i am running it in plesk
[13:54:57] braindead_: but the server is not running. at least i cant reach the app in browser
[13:55:43] braindead_: it just returns "command here" successfully completed in 0 seconds.
[13:58:38] braindead_: can i somehow check if the app is running in the background?
[14:00:15] amar: has joined #ruby
[14:02:16] amelliaa: has joined #ruby
[14:03:03] scrooloose: braindead_: you can ssh onto the machine right? why not just search/grep the output of `ps -eF` or similar? or `lsof -nPi` and see what is listening
[14:03:21] vondruch: has joined #ruby
[14:04:47] braindead_: thanks. it seems like nothing is started
[14:05:14] wkoszek: havenwood: Thanks.
[14:05:30] braindead_: when i paste this into shell nothing happens as well: cd /var/www/vhosts/domain/httpdocs && env RAILS_ENV=production sh -c 'cd /var/www/vhosts/domain/httpdocs bundle exec ruby script/mail_new_activity; cd /var/www/vhosts/domain/httpdocs bundle exec ruby script/post_to_twitter'
[14:05:46] braindead_: normally i start the server like this: rails s -e production
[14:05:48] sinduck: has joined #ruby
[14:06:11] braindead_: do i maybe need to add this before the &&
[14:07:47] scrooloose: braindead_: are these just periodic tasks you are wanting to run?
[14:08:32] braindead_: i am trying the last part of this install guide: https://github.com/lobsters/lobsters
[14:08:45] braindead_: app is running and all but i need to do it manually right now
[14:08:57] braindead_: this cronjob seems to automate the task
[14:09:53] scrooloose: well, I see the script files in question load the rails env, so you dont need to do that yourself
[14:10:04] gnufied: has joined #ruby
[14:10:25] braindead_: but nothing happens or at least i cant see a result. app is not available too
[14:10:43] henoc: hello friends
[14:10:59] henoc: does anybody here that can helps me to use this project? https://github.com/taskrabbit/makara
[14:11:04] scrooloose: if you run the command, does it output to any log files? try running then look at `find / -mmin -5` and see if it changed any files
[14:11:31] henoc: What I need to do for use it ?
[14:11:44] amatas: has joined #ruby
[14:11:56] henoc: for execute this
[14:12:11] henoc: to execute this
[14:12:33] scrooloose: braindead_: other than that I would say to start sticking `puts` commands inside the scripts and see what is happening
[14:14:42] braindead_: find / -mmin -5 results in an huge output. cant see if there changes something.
[14:16:14] braindead_: i just opened one of the scripts. where would i stick puts in? just at the beginning?
[14:17:20] dviola: has joined #ruby
[14:18:31] jrafanie: has joined #ruby
[14:19:06] gnufied: has joined #ruby
[14:19:37] BlopMonster: has joined #ruby
[14:20:11] gigetoo: has joined #ruby
[14:24:31] TheBetrayer: has joined #ruby
[14:38:54] braindead_: scrooloose: maybe you have an idea
[14:39:14] braindead_: if i ssh to the path and run ->> rails s && env RAILS_ENV=production sh -c 'bundle exec ruby script/mail_new_activity' it works
[14:40:25] braindead_: but when i stay at the same path and type ->> cd /var/www/vhosts/domain/httpdocs rails s && env RAILS_ENV=production sh -c 'bundle exec ruby script/mail_new_activity' nothing happens. no error, no server start
[14:41:01] chouhoulis: has joined #ruby
[14:41:04] workmad3: has joined #ruby
[14:43:46] gizmore: has joined #ruby
[14:44:24] mnemon: braindead_: cd fails with 3 arguments, nothing after && will be run.
[14:44:40] arekushi: has joined #ruby
[14:44:53] mnemon: cd /var/www/vhosts/domain/httpdocs; rails s && ...
[14:45:46] braindead_: that worked! thank you mnemon
[14:48:29] ellcs: has joined #ruby
[14:50:50] millerti: has joined #ruby
[14:53:21] za1b1tsu: has joined #ruby
[14:53:41] xuyuheng: has joined #ruby
[14:54:15] _aeris_: https://social.imirhil.fr/system/media_attachments/files/000/144/914/original/a3d360028f486991.png
[14:54:33] _aeris_: i have this strange behaviour on Hash with a default value to empty array
[14:55:05] _aeris_: how is it possible to have .keys returning empty, but having real not default value for a key ? ><
[14:57:00] _aeris_: even f.has_key? :foo return false ><
[14:58:21] stairmast0r: has joined #ruby
[14:58:27] troys: has joined #ruby
[15:00:12] karapetyan: has joined #ruby
[15:01:28] xuyuheng: has joined #ruby
[15:01:47] sleetdrop: has joined #ruby
[15:03:13] pwnd_nsfw: has joined #ruby
[15:07:08] GodFather_: has joined #ruby
[15:10:39] grilix: has joined #ruby
[15:13:52] karapetyan: has joined #ruby
[15:15:52] cdunklau: _aeris_: heh. the default is shared
[15:16:07] yokel: has joined #ruby
[15:16:43] darix: _aeris_: next time use something like https://gist.github.com/ - then people dont have to type all the stuff again
[15:17:06] darix: cdunklau: I would still expect f.keys to return something. dont you?
[15:17:16] BlopMonster: has joined #ruby
[15:17:46] cdunklau: darix: sure, it's odd
[15:17:49] cdunklau: darix: but https://bpaste.net/show/1166ea95c4bd
[15:18:12] cdunklau: darix: looks like f[:foo] << :bar doesn't care that the left side is a hash access whateveryoucallit
[15:18:26] cdunklau: it just does f[:foo], which returns the default array. and then appends to it
[15:19:00] synthroid: has joined #ruby
[15:19:04] scrooloose: i.e. none of that code is actually setting a value for f[:foo]
[15:19:09] darix: so pass in a block to Hash.new, that returns an array instance
[15:19:49] cdunklau: _aeris_: the solution appears to be Hash.new { [] }
[15:20:19] _aeris_: cdunklau > nope, doesn't work too
[15:20:31] cdunklau: reminds me of the `def foo(arg=[]):` trap in python
[15:20:38] pabs: Hash.new { |h, k| h[k] = [] }
[15:21:18] cdunklau: _aeris_: sure it does. you just can't append to an array for a key that doesn't exist yet
[15:21:25] cdunklau: at least not like that
[15:21:36] _aeris_: https://gist.github.com/aeris/66fe472ed6dfe9d0aa2db2bc69402bda
[15:21:51] whippythellama: has joined #ruby
[15:22:40] pabs: >> %w{a s d f}.each_with_object(Hash.new { |h, k| h[k] = [] }) { |c, h| h[c] << c }
[15:22:41] ruby[bot]: pabs: # => {"a"=>["a"], "s"=>["s"], "d"=>["d"], "f"=>["f"]} (https://eval.in/1018897)
[15:22:43] pabs: => {"a"=>["a"], "s"=>["s"], "d"=>["d"], "f"=>["f"]}
[15:22:54] cdunklau: _aeris_: you could do it with f[:foo] <<= :bar
[15:23:14] cdunklau: _aeris_: if you use the basic Hash.new { [] }
[15:23:48] gigetoo: has joined #ruby
[15:24:00] cdunklau: are method default args evaluated on call or on definition?
[15:24:19] cdunklau: wait, i could easily TIAS nm
[15:38:57] chouhoulis: has joined #ruby
[15:39:19] venmx: has joined #ruby
[15:42:42] gizmore: expect(mod).to(not_equal(mod2))
[15:42:42] gizmore: # undefined method not_equal
[15:43:11] asio: has joined #ruby
[15:53:28] MyMind: has joined #ruby
[15:55:29] dionysus69: has joined #ruby
[15:58:10] konsolebox: has joined #ruby
[16:01:23] mikecmpbll: has joined #ruby
[16:06:19] gigetoo: has joined #ruby
[16:07:33] joast: has joined #ruby
[16:07:45] grilix: has joined #ruby
[16:08:54] jcarl43: has joined #ruby
[16:14:38] andrewray: has joined #ruby
[16:16:47] karapetyan: has joined #ruby
[16:17:39] cthulchu: has joined #ruby
[16:19:00] darkhanb: has joined #ruby
[16:23:44] za1b1tsu: has joined #ruby
[16:26:45] eckhardt: has joined #ruby
[16:27:17] eckhardt: has joined #ruby
[16:31:51] amar: has joined #ruby
[16:33:08] kmurphy4: has joined #ruby
[16:37:14] akaiiro: has joined #ruby
[16:37:52] gigetoo: has joined #ruby
[16:42:41] Eiam: has joined #ruby
[16:43:13] drale2k_: has joined #ruby
[16:43:54] Zladivliba: has joined #ruby
[16:44:45] bbobb: has joined #ruby
[16:45:36] conta: has joined #ruby
[16:47:32] chouhoulis: has joined #ruby
[16:48:11] chouhoulis: has joined #ruby
[16:48:15] baweaver: >> %w(a b c c c).group_by(&:itself) # pabs / _aeris_
[16:48:16] ruby[bot]: baweaver: # => {"a"=>["a"], "b"=>["b"], "c"=>["c", "c", "c"]} (https://eval.in/1018977)
[16:48:40] baweaver: gizmore: where'd you find that syntax?
[16:48:50] baweaver: It's to_not
[16:48:57] gizmore: baweaver: its mine.... ended up with:
[16:49:04] gizmore: expect(mod != mod2).to be_truthy
[16:49:40] baweaver: Y'might want to read through the Relish docs for RSpec, it'll be easier. The matchers also give better errors when something goes wrong
[16:50:24] sanscoeur: has joined #ruby
[16:51:19] BlopMonster: has joined #ruby
[16:52:01] baweaver: cdunklau: <<= doesn't exist.
[16:53:03] baweaver: This is how hash constructors work - https://medium.com/@baweaver/abusing-hash-constructors-65d59c0a5b27
[16:53:42] gizmore: baweaver: please read my specfile :) ...... https://github.com/gizmore/gdo/blob/master/spec/gdo_spec.rb
[16:53:55] gizmore: it's trusty site... from microsoft
[16:56:04] gregf_: has joined #ruby
[16:57:30] gizmore: baweaver: gotta go.... feedback on my stuff is welcome... might query me if you like... baba
[16:57:42] Azure: has joined #ruby
[16:58:05] Zladivliba: hey everyone
[16:58:28] Zladivliba: fd.write("%s: \"%s\"\n" % [key.gsub(/comment_/,''), value])
[16:58:40] Zladivliba: I need to remove " in %s
[16:58:49] Zladivliba: any idea how i can do that ?
[16:59:08] cadillac_: has joined #ruby
[17:00:01] [Butch]: has joined #ruby
[17:00:49] baweaver: >> %(String with "a lot" 'of' """"quotes"""").delete(%('"))
[17:00:50] ruby[bot]: baweaver: # => "String with a lot of quotes" (https://eval.in/1018994)
[17:01:54] Zladivliba: baweaver: i don't speek ruby at all... i'm just editing a file to make something work
[17:02:07] Zladivliba: so that would be value.delete... right ?
[17:02:14] baweaver: Give it a try.
[17:02:48] Zladivliba: will it work if i do that : fd.write("%s: \"%s\"\n" % [key.gsub(/comment_/,''), value.delete(%('"))])
[17:03:32] Zladivliba: you're removing ' also right ?
[17:03:39] Zladivliba: actually i need '
[17:03:44] baweaver: then remove that
[17:04:14] soniya29: has joined #ruby
[17:04:19] venmx: has joined #ruby
[17:04:19] soniya29_: has joined #ruby
[17:04:32] Zladivliba: baweaver: ok thanks, i'm trying... (taking a while...)
[17:04:53] Zladivliba: baweaver: `block (3 levels) in <top (required)>': undefined method `delete' for nil:NilClass (NoMethodError)
[17:05:42] baweaver: What do you think went wrong?
[17:06:01] [Butch]: has joined #ruby
[17:07:07] Zladivliba: hum i don't know... The value should apply to the second %s, so it's possible it's an array ?
[17:07:10] Zladivliba: not a string
[17:10:04] gigetoo: has joined #ruby
[17:12:49] Zladivliba: baweaver: was that the case ?
[17:13:18] baweaver: Read that error
[17:13:27] baweaver: only what's after the :
[17:13:38] Zladivliba: search online but can't find result that makes sense
[17:13:51] Zladivliba: (i don't program in ruby...)
[17:14:49] baweaver: NoMethodError
[17:14:52] baweaver: undefined method `delete'
[17:14:59] baweaver: What do those two indicate to you?
[17:15:01] chouhoul_: has joined #ruby
[17:15:17] Zladivliba: like GDPR article 6.1.a
[17:15:21] baweaver: ironically you're correct
[17:15:28] Zladivliba: i don't understnad what it means
[17:15:32] Zladivliba: that's why i'm here
[17:15:41] baweaver: and I'm trying to help you understand
[17:15:42] Zladivliba: otherwise i would solve the problem and not bother anyone about it
[17:15:46] baweaver: that's why I'm here.
[17:16:02] Zladivliba: ok but you're too cryptic about it for me to understnad anything
[17:16:20] Zladivliba: like i understnad i have an value/key
[17:16:27] Zladivliba: and it's trying to write that
[17:16:28] baweaver: A method is a function called on an object
[17:16:50] baweaver: Now if something says undefined method and NoMethodError, what do you think that means
[17:17:03] Zladivliba: hum there's no function
[17:17:05] Zladivliba: so no object
[17:17:18] baweaver: the second part tells us
[17:17:26] baweaver: "for nil:NilClass"
[17:17:33] Zladivliba: that's like chineese to me
[17:17:36] baweaver: nil is an object, but it's also "nothing"
[17:17:49] Zladivliba: ok what is for ?
[17:18:06] baweaver: Zladivliba: waxing about how things aren't understandable isn't going to do you any good. Ask questions about it instead.
[17:18:06] Zladivliba: so 'there's no method for no method...'
[17:18:09] Zladivliba: i don't get it
[17:18:16] baweaver: There's no method for nil
[17:18:20] baweaver: >> nil.delete
[17:18:21] ruby[bot]: baweaver: # => undefined method `delete' for nil:NilClass (NoMethodError) ...check link for more (https://eval.in/1019009)
[17:18:25] Zladivliba: ok so what is inside my valye ?
[17:18:27] Zladivliba: is it a string ?
[17:18:49] baweaver: >> ''.delete
[17:18:50] ruby[bot]: baweaver: # => "" (https://eval.in/1019010)
[17:19:02] amar_: has joined #ruby
[17:19:10] baweaver: So one of your values is nil, which means it has no idea what you mean by "delete"
[17:19:29] Zladivliba: https://www.pastiebin.com/5b1eaf1dcd403
[17:19:32] Zladivliba: check the code
[17:20:26] Zladivliba: ok so i don't understand any of the code you sent it's like way to advanced for me
[17:21:00] baweaver: questions, not complaints.
[17:21:08] baweaver: I can't do anything with "too advanced"\
[17:21:18] Zladivliba: ok so what's the value inside value
[17:21:20] Zladivliba: is it a string ?
[17:21:35] Zladivliba: i can't understand that - that' would be my first point of entry
[17:21:37] Zladivliba: in the code i sent
[17:22:06] baweaver: If it were a string that delete would have worked
[17:22:14] baweaver: what happened when I called it on nil?
[17:22:22] Zladivliba: i don't undesrtand your nil
[17:22:31] Zladivliba: it's GDPR to me
[17:22:43] Zladivliba: actually i understand gdpr better
[17:23:02] Zladivliba: ok so second question : why isn't it a string
[17:23:11] Zladivliba: there should be some data inside
[17:23:26] Zladivliba: is there some data inside ? and if yes why it's not a string ?
[17:25:07] baweaver: There's no data inside.
[17:25:48] Zladivliba: i got it, it's failing because inside my array - originally - some of the data is empty
[17:25:58] Zladivliba: so if I add a test if string() it should work right ?
[17:32:07] baweaver: https://www.pastiebin.com/5b1eb20bbef6f
[17:32:07] apeiros: has joined #ruby
[17:32:23] baweaver: Or use that, less of a mess than the original script
[17:32:50] baweaver: Anyways, off I go.
[17:37:30] chouhoulis: has joined #ruby
[17:39:14] nfk: has joined #ruby
[17:39:15] Zladivliba: baweaver: thanks. It's a script to export wp comments i found online, i'm trying to migrate to Jekyll
[17:39:44] Zladivliba: baweaver: your code doesn't work, same problem
[17:39:54] Zladivliba: undefined method `[]' for nil:NilClass (NoMethodError)
[17:40:18] cdunklau: baweaver: my ruby isn't good enough yet to grok the madness in that post. <<= definitely does work though https://bpaste.net/show/dbeef5e8a1a3
[17:40:52] cdunklau: baweaver: but i guess i don't understand what exactly that's _doing_
[17:43:49] gigetoo: has joined #ruby
[17:44:24] jrich523: has joined #ruby
[17:46:45] spiette: has joined #ruby
[17:50:38] giraffe: has joined #ruby
[17:51:26] tpendragon: has joined #ruby
[17:52:41] jrich523: https://gist.github.com/jrich523/634bcc92a94568de0aa6a0fc509c3944
[17:52:49] jrich523: that makes my eyes bleed.. there has to be a better way right?
[17:53:26] audy: jrich523: try?
[17:54:06] jrich523: ahh cool, thanks!
[17:54:21] audy: jrich523: but that's a rails thing and works for attributes not hash keys
[17:54:36] audy: jrich523: you can do hash.dig(:key1, :key2, ...) in plain ruby
[17:54:44] jrich523: let me try it
[17:55:02] noron99: has joined #ruby
[17:55:51] jrich523: if i try, nodes[0].dig(:facts, :kvm) i get nil
[17:55:55] noron99: Hello, does anyone use Sinatra?
[17:56:04] havenwood: noron99: Yes, they sure do!
[17:57:13] noron99: Do you know the documentation to create an API?
[17:57:39] jrich523: looks like you just define routes
[17:57:46] jrich523: so should be super easy to make an API interface
[17:58:13] sphenxes: has joined #ruby
[17:58:14] gigetoo: has joined #ruby
[17:59:14] chouhoul_: has joined #ruby
[17:59:15] noron99: Okay, it happens that it's my first API
[17:59:20] agent_white: has joined #ruby
[17:59:26] jrich523: the readme covers most topics
[17:59:38] jrich523: but really its just a method (get/post/ not sure what else is supporteD)
[17:59:42] jrich523: and then a path
[18:00:16] jrich523: they even show you how to use variables in the path and such
[18:00:34] jrich523: its just a set of paths and actions for those paths, easiest api you'll ever create (probably)
[18:02:16] noron99: ok, thank you very much, I thought it was much more
[18:02:25] jrich523: nah its really basic
[18:02:28] noron99: what routes
[18:02:32] jrich523: its the front end thats hard :)
[18:02:39] jrich523: routes are what query strings use to be lol
[18:02:46] jrich523: you use to do stuff like
[18:02:49] wontruefree: has joined #ruby
[18:03:02] jrich523: api/entrypoint?option1=something
[18:03:04] jrich523: now its more like
[18:03:15] jrich523: api/action/optionValue
[18:03:22] jrich523: each part of the url is info to the API
[18:03:46] jrich523: get '/hello/:name' do
[18:03:50] jrich523: which is what they are showing there
[18:04:00] jrich523: the route is hello and then an a name
[18:04:09] jrich523: routes usually sort of tier down so to speak
[18:04:17] jrich523: a better example woudl be
[18:04:21] noron99: All right, it happens that I'm also just learning ruby
[18:04:23] jrich523: get 'users'
[18:04:30] dbugger_: has joined #ruby
[18:04:36] amatas: has joined #ruby
[18:04:37] jrich523: get '/users/:name'
[18:04:42] jrich523: which would get all users vs get one users
[18:05:13] jrich523: checkout the readme, it shows examples of the route types
[18:05:23] jrich523: you've got wildcards too
[18:06:04] jrich523: yeah mostly magic, you dont have to worry about anything other than your actions... pretty simple :)
[18:06:44] noron99: thanks bro
[18:07:04] noron99: Have you used grappe?
[18:07:45] jrich523: i actually dont do much ruby
[18:08:08] jrich523: im just dumped on to random things, and am told to figure it out
[18:08:26] jrich523: just recently happens to be ruby puppet/foreman stuff :)
[18:08:39] al2o3-cr: doing `f[:foo] <<= 1` is the same as doing `f[:foo] = f[:foo] << 1`
[18:08:53] noron99: Which framework do you recommend to create API, SInatra or Rails::API?
[18:10:02] jrich523: just taking a look at sinatra, it looks pretty solid and extensive
[18:10:10] jrich523: but probably not as extensive or customizable as rails
[18:10:19] jrich523: so in your case, probably stick with sinatra?
[18:10:31] TomyLobo: has joined #ruby
[18:11:34] noron99: I am a programmer and they told me to study ruby
[18:11:51] noron99: if I stay with Sinatra
[18:12:12] darix: noron99: learn the basics. and apply them to what ever framework will be the best for that task at hand
[18:12:14] noron99: It is said to be the best option for API
[18:12:22] al2o3-cr: >> s = "hell"; s <<= 111
[18:12:23] ruby[bot]: al2o3-cr: # => "hello" (https://eval.in/1019057)
[18:12:51] darix: noron99: that can matter a lot on the case
[18:13:14] darix: someone else posted the other day here how they prefer a framework hasomething nowadays
[18:13:50] noron99: Así es, incluso estoy pensando que el APIS, hacer un rack con grape
[18:13:59] darix: gitlab uses grape
[18:15:03] noron99: but I do not know whether to make the apis also with grape, so as not to use too much framework
[18:15:30] darix: noron99: lets say someone asks you do add an API for an existing app.
[18:15:31] eckhardt_: has joined #ruby
[18:15:40] darix: and the existing app is rails. but you only learned sinatra
[18:15:47] darix: would you write the api in sinatra?
[18:16:38] noron99: Puede ser integrado
[18:16:44] noron99: It can be integrated
[18:17:20] noron99: I plan to integrate it with Rails
[18:18:30] za1b1tsu: has joined #ruby
[18:19:58] orbyt_: has joined #ruby
[18:21:10] dr3wo: has joined #ruby
[18:23:23] clemens3: has joined #ruby
[18:24:43] sepp2k: has joined #ruby
[18:25:14] amar: has joined #ruby
[18:25:23] burgestrand: has joined #ruby
[18:27:36] jrich523: audy dig works, but i have to use strings and not symbols .dig("facts","kvm")
[18:27:56] ramfjord: has joined #ruby
[18:28:03] audy: jrich523: 'cause your keys are strings and not symbols
[18:28:24] jrich523: yeah, not much of a choice, its the return of the puppetdb module (json)
[18:32:20] grilix: has joined #ruby
[18:36:01] headius: has joined #ruby
[18:42:55] burgestrand: has joined #ruby
[18:45:03] chouhoulis: has joined #ruby
[18:46:06] drale2k_: has joined #ruby
[18:47:16] orbyt_: has joined #ruby
[18:47:26] za1b1tsu: has joined #ruby
[18:49:03] gigetoo: has joined #ruby
[18:50:00] solocshaw: has joined #ruby
[18:51:35] henoc: does anybody here that can helps me to use this project? https://github.com/taskrabbit/makara
[18:51:53] henoc: What I need to do for run it ?
[18:55:25] Zarthus: didn't i answer this
[18:58:54] noron99: right there tells you how to install it
[18:59:42] solocshaw: has joined #ruby
[19:01:39] solocshaw: has joined #ruby
[19:02:53] amar: has joined #ruby
[19:02:55] weird_error: has joined #ruby
[19:03:30] Lytol: has joined #ruby
[19:03:42] drale2k_: has joined #ruby
[19:04:14] Neptu: has joined #ruby
[19:07:25] plexigras: has joined #ruby
[19:07:44] henoc: noron99: yes, I do it, but How can I run it
[19:07:53] henoc: rails server <-- ?
[19:08:35] noron99: http://localhost:4567
[19:12:11] gizmore: # Hook i18n into all objects? (good idea?)
[19:12:11] gizmore: class Object; def t(key, *args); ::GDO::Lang::Trans.instance.translate(key, *args); end; end
[19:12:45] havenwood: gizmore: bad idea ;-P
[19:13:04] gizmore: havenwood: you should look at my event class.... it is one page and works Oo
[19:13:18] gizmore: the global t() function also "works" :D
[19:13:43] gizmore: i love ruby.... totally different than php tho :/ (the apache mod stuff)
[19:13:47] gizmore: a ruby app is long living
[19:13:59] gizmore: a php app is one page all new all kill
[19:14:23] gizmore: btw, i am doing a completely new approach to the dba / entitiy stuff
[19:14:35] gizmore: activerecord and laravel is outdated
[19:16:32] havenwood: gizmore: Defining your global method on Kernel would be slightly better. Better yet, you can use refinements.
[19:19:20] gizmore: Like "class Kernel" for a monkeypatch would work?
[19:19:29] havenwood: gizmore: module Kernel
[19:19:42] gizmore: this gets mixed into Object?
[19:19:53] havenwood: gizmore: yup
[19:20:28] gizmore: btw.... what about this include: https://github.com/gizmore/gdo/blob/master/lib/GDO/Core/StringUtil.rb
[19:20:35] gizmore: comments very welcome
[19:20:40] havenwood: >> module Kernel; def gizmore; :gizmore end end; gizmore
[19:20:41] ruby[bot]: havenwood: # => :gizmore (https://eval.in/1019114)
[19:21:02] GodFather: has joined #ruby
[19:21:11] gizmore: >> module Kernel; def gizmore; :gizmore end end; gizmore; Object.new.gizmore
[19:21:28] havenwood: gizmore: This is what a refinement might look like: https://gist.github.com/havenwood/3c6329429e91c6703f5e86fc97be0e8e
[19:21:48] gizmore: never heard of refine
[19:21:49] havenwood: gizmore: The `using T` can then be put at the top of the class where you want `t` available.
[19:22:07] havenwood: gizmore: That way it's lexically scoped, and only happens in the file where it's used.
[19:22:29] havenwood: gizmore: https://docs.ruby-lang.org/en/2.5.0/syntax/refinements_rdoc.html
[19:23:14] gizmore: btw, i am coding an own ActiveRecord. i would like to discuss the approach with someone... we can do this in #gdo :P
[19:23:17] jrich523: what is the ruby 1.9 hash syntax? (i wish rubocop had id's i could lookup)
[19:23:35] gizmore: jrich523: { key: val } should work?
[19:23:39] henoc: gizmore: :)
[19:23:39] havenwood: gizmore: #RubyOnRails sounds like the right place for that.
[19:23:58] havenwood: gizmore: oh, coding your own - gotcha
[19:24:05] havenwood: nvm then, here is probably a better place
[19:24:10] gizmore: havenwood: no... activerecord was just an example..... the activerecord dba is horrible slow
[19:24:20] havenwood: gizmore: Sequel ftw.
[19:24:21] jrich523: it works fine, just wondering why rubocop is complainig about..
[19:24:22] jrich523: kvms.push({:site => n['ss_site'], :hostname => n['hostname'], :guestcount => (n.dig('facts', 'kvm', 'guests') || []).count })
[19:24:26] gizmore: i am doing an own dba.... (i am porting my own dba from php)
[19:24:27] jrich523: basically its that now
[19:24:54] gizmore: jrich523: what is the exact exception? (and don't swallow)
[19:24:59] henoc: havenwood: thank you
[19:25:27] havenwood: jrich523: kvms.push site: n['ss_site'], hostname: n['hostname'], guest_count: n.dig('facts', 'kvm', 'guests').to_i
[19:25:38] havenwood: >> nil.to_i
[19:25:39] ruby[bot]: havenwood: # => 0 (https://eval.in/1019115)
[19:26:29] jrich523: oddly that removed other "issues" but the "use ruby 1.9 hash syntax" is still there
[19:26:53] jrich523: Style/HashSyntax: Use the new Ruby 1.9 hash syntax. (convention:Style/HashSyntax)
[19:26:58] havenwood: jrich523: It must be another line. Search for: =>
[19:27:19] RougeR: i need to an active record query join request not quite sure how. ive got tables called climbs, routes, gyms
[19:27:27] havenwood: jrich523: a `=>` is a "Hash rocket". If you use a Hash rocket with a Symbol key, Rubocop will whine.
[19:27:29] jrich523: the :site => has the green underline
[19:27:33] RougeR: i want to find which gym a climb belongs to
[19:27:38] jrich523: ahh thats probably it :)
[19:27:39] havenwood: jrich523: Note how I wrote that.
[19:27:41] RougeR: there are relations between climb and route
[19:27:41] gizmore: havenwood: thanks for your support all the years! i remember your nick since ages. thx
[19:27:43] RougeR: and route and gym
[19:27:49] havenwood: gizmore: You're welcome!
[19:27:52] RougeR: but not betwen climb and gym
[19:28:03] jrich523: gotcha! thanks
[19:28:20] jrich523: that was somewhere in my memory too... damn recall problems :-/
[19:29:35] al2o3-cr: they've aliased yield_self -> then
[19:29:58] havenwood: 42.then(&:itself) #=> 42
[19:30:23] al2o3-cr: i kinda like it
[19:31:09] za1b1tsu: has joined #ruby
[19:31:13] anisha: has joined #ruby
[19:33:12] havenwood: ?rails RougeR
[19:33:13] ruby[bot]: RougeR: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[19:33:30] havenwood: https://freenode.net/kb/answer/registration
[19:34:11] RougeR: its always so dead there, but yeah will do
[19:34:50] dviola: has joined #ruby
[19:34:52] jrich523: hmm so it doesnt seem like that syntax likes to be spread across lines..
[19:34:58] mantak: has joined #ruby
[19:37:20] jrich523: havenwood the change in syntax for the count doesnt fly, since it cant to_i a set of child hashes
[19:37:41] havenwood: jrich523: How do you count those?
[19:37:50] dviola: has joined #ruby
[19:37:57] jrich523: :guestcount => (n.dig('facts', 'kvm', 'guests') || []).count })
[19:38:17] jrich523: i did that cuz i dont know what im doing, but the guest key is a set of guest objects (hash of a few simple params)
[19:38:48] havenwood: jrich523: What does this return?: n.dig('facts', 'kvm', 'guests')
[19:39:47] jrich523: a hash, where the key is the guest name, and the value is a hash of properties
[19:41:40] havenwood: jrich523: And you're trying to count the properties? Or?
[19:41:52] jrich523: jsut the number of guests (key count?)
[19:42:16] jrich523: guests.count which was fine, until some returned nil, which made me write that funkiness
[19:42:29] havenwood: jrich523: n.dig('facts', 'kvm', 'guests')&.size.to_i
[19:42:38] telmac: has joined #ruby
[19:43:29] telmac: so let's say I want to do something equivalent to like, performing a test on every element in the cartesian product of two sets
[19:45:02] telmac: my first intution was do two nested while loops, but, and this I don't understand, resulted in the function ending too soon? so it would do the first iteration of the first while loop
[19:45:19] telmac: and all of the iterations of the second while loop, and then just end
[19:45:42] telmac: when I tried two nested for loops, this *did* work, but for in ruby returns an array at the end, which I don't want
[19:46:48] ramfjord_: has joined #ruby
[19:48:11] orbyt_: has joined #ruby
[19:48:49] havenwood: telmac: What are you doing inside the loop?
[19:48:56] plexigras2: has joined #ruby
[19:48:59] havenwood: telmac: finding or filtering or mapping or other?
[19:49:35] havenwood: telmac: I was just looking at a slightly dated but still nice gem yesterday called combinatorics: https://github.com/postmodern/combinatorics
[19:50:07] havenwood: telmac: require 'combinatorics/cartesian_product'; Set.new(%w[a b c]).cartesian_product(Set.new([1, 2, 3])).select { |a, b| b > 2 } #=> [["a", 3], ["b", 3], ["c", 3]]
[19:50:38] plexigras2: has left #ruby: ()
[19:50:45] telmac: ah, a friend of mine explained the problem
[19:51:13] telmac: I wasn't resetting the second iterated variable to 0
[19:51:29] telmac: so when I iterated the first one, the while loop for the second one just ended immediately
[19:55:45] drale2k_: has joined #ruby
[19:58:04] dendazen: has joined #ruby
[20:04:48] zenspider: anyone currently on ubuntu or have one nearby?
[20:05:22] havenwood: zenspider: yerp
[20:06:01] telmac: has left #ruby: ()
[20:06:37] zenspider: havenwood: why a gem for that? just so it works on set?
[20:06:40] zenspider: >> [1,2,3].to_a.product(%w[a b c]).select { |n,s| n > 2 }
[20:06:48] havenwood: zenspider: want a sanity check on something?
[20:07:08] zenspider: havenwood: yeah. I can't get a repro on my mac for this report: https://github.com/jbarnette/hoe-git/issues/13#issuecomment-396363699
[20:07:16] havenwood: zenspider: I didn't really look into it, but there's a benchmark/ directory so I was assuming yeah performance
[20:08:59] zenspider: man... I cannot stand the way postmodern structures their gems. ugh. I'm done digging
[20:09:35] havenwood: zenspider: #=> 66
[20:10:10] zenspider: meaning you can't repro either?
[20:10:45] zenspider: did you use LANG=fr_FR.UTF-8 ruby blahblah ?
[20:11:00] jokke1: has joined #ruby
[20:11:07] orbyt_: has joined #ruby
[20:11:19] zenspider: oooh... maybe I need to install git under that lang to get the proper locale?
[20:11:25] havenwood: zenspider: Yeah, I can't reproduce with just the LANG export.
[20:11:32] havenwood: I don't have FR installed.
[20:12:08] zenspider: kk. I'll have to try this the hard way
[20:12:11] havenwood: I mean, I didn't install git under FR.
[20:12:25] havenwood: zenspider: gl!
[20:12:33] zenspider: I would THINK that it doesn't selectively install langs... but who knows?
[20:12:42] drale2k_: has joined #ruby
[20:13:21] eckhardt: has joined #ruby
[20:14:07] grilix_: has joined #ruby
[20:17:55] za1b1tsu: has joined #ruby
[20:18:14] workmad3: has joined #ruby
[20:19:08] jenrzzz: has joined #ruby
[20:19:08] jenrzzz: has joined #ruby
[20:20:19] zenspider: has joined #ruby
[20:27:13] apeiros_: has joined #ruby
[20:30:16] RougeR: has joined #ruby
[20:36:15] zenspider: trying to install ubuntu in french... this is going poorly
[20:37:43] mozzarella: la baguette le fromage
[20:38:23] dviola: zenspider: what's the issue?
[20:38:52] jenrzzz: has joined #ruby
[20:39:49] drale2k_: has joined #ruby
[20:40:04] \void: has joined #ruby
[20:41:43] dbugger__: has joined #ruby
[20:42:16] Azure|dc: has joined #ruby
[20:42:40] eam: the computer went on strike
[20:43:06] mozzarella: I don't think it's a good idea to rely on the output of git status like that…
[20:44:49] braindead_: cross posting this question from #rubyonrails because i think its also valid in ruby
[20:44:51] braindead_: in my rails app there is a view template where the text is rendered like this: render :html => ("<div class=\"box wide\">" << "text here" << i can add html tags like br, strong and so on there but run into errors while trying to include a img tag. is there a workaround?
[20:45:09] karapetyan: has joined #ruby
[20:46:48] dviola: zenspider: try `locale -a'?
[20:50:21] dviola: on my system I would have to uncomment the locale in /etc/locale.gen, run locale-gen and set LANG=fr_FR.UTF-8 in /etc/locale.conf, in ubuntu there must be a GUI somewhere
[20:51:58] orbyt_: has joined #ruby
[20:54:19] kmurphy4: has joined #ruby
[20:55:36] dr3wo: has joined #ruby
[21:06:38] neohunter: has joined #ruby
[21:11:32] zenspider: dviola: HOW THE HELL DO YOU TYPE @ IN AZERTY?!?
[21:11:39] zenspider: STUPID GIT REQUIRES AN EMAIL
[21:12:17] zenspider: I'm mostly there tho... I have ruby and git installed. I'm making a bogus git repo. Then I should be able to reproduce this error
[21:12:47] zenspider: tho it might be worth it to do what you said so I have qwerty (or better, dvorak) but have the locales installed and working
[21:13:01] sameerynho: has joined #ruby
[21:13:20] zenspider: yeah. fuck it. this is too hard.
[21:13:22] kspencer: zenspider: AltGr+0
[21:14:19] zenspider: I honestly don't even know what that means :P
[21:15:00] zenspider: I just nuked it. Reinstalling w/ dvorak so I can type like a human.
[21:15:07] zenspider: shouldn't take too long
[21:15:27] kspencer: how bout qwerty so you can type like a human
[21:16:22] dviola: you could change the keyboard layout with setxkbmap
[21:16:27] dviola: setxkbmap dvorak
[21:16:29] dviola: setxkbmap us
[21:16:51] zenspider: it's fine. this should only be another minute or two
[21:17:04] zenspider: does that work in non-x11? I'm only in console (vmware)
[21:17:36] zenspider: (I'm more of a freebsd / osx guy)
[21:17:50] dviola: setxkbmap is X11 specific, iirc
[21:18:19] zenspider: yeah. that's what I thought. tho I usually used xmodmap... but I'm old school
[21:18:22] dviola: there must be something for the linux console
[21:18:38] zenspider: in freebsd it is keymap
[21:18:44] kspencer: whats your aversion to qwerty
[21:19:01] zenspider: it utterly sucks and I don't type in it.
[21:20:49] darix: azerty is real pita though :P
[21:20:54] kspencer: sucks, objective, but yeah I guess I'm on the other boat, I've typed in qwerty all my life, not wanting to go dvorak or azerty because it would be hell trying to learn it and switch between it depending on the computer
[21:20:56] zenspider: emacs ... git ... ruby ... almost there
[21:21:52] zenspider: kspencer: I generally don't have to switch. ever. I refused to get good at something designed to be bad so I never touchtyped qwerty
[21:23:09] neohunter: has joined #ruby
[21:23:09] Hobbyboy: has joined #ruby
[21:23:50] ur5us: has joined #ruby
[21:23:57] dviola: zenspider: I think it's loadkeys
[21:23:59] zenspider: dviola: hrm... I don't have either of those files in /etc/
[21:24:41] dviola: sudo loadkeys dvorak
[21:24:49] dviola: sudo loadkeys us
[21:25:52] dviola: it works here, except that I can't type with dvorak :P
[21:26:21] zenspider: you can type "mama" just fine :P
[21:26:42] zenspider: `locale -a` only lists en_* entries
[21:27:55] Megamos: has joined #ruby
[21:28:04] t0xik: has joined #ruby
[21:29:04] dviola: try: sudo locale-gen fr_FR.UTF-8
[21:29:16] dviola: then locale-a again
[21:29:47] dviola: sudo locale-gen fr_FR.UTF-8 && sudo update-locale
[21:32:00] zenspider: ok. that works... but my git doesn't change its messages even with LC_MESSAGES
[21:32:27] zenspider: no such file or directory when I try to export that
[21:32:35] zenspider: this might not be worth my effort in the long run
[21:32:55] cyberg: has joined #ruby
[21:34:32] dviola: zenspider: have you tried with LANG?
[21:34:40] schneider: has joined #ruby
[21:34:43] dviola: like LANG=fr_FR.UTF-8 git foo
[21:36:56] zenspider: yeah. and I did localectl set-locale LANG=fr_blahblah as well. nothing
[21:37:19] zenspider: I did notice that the package source had ".fr." in the url for my french install
[21:37:43] zenspider: I'd probably have to figure out how to do that, uninstall git, and reinstall from the french source
[21:38:51] zenspider: hah. I get french man pages tho
[21:38:57] zenspider: not exactly helpful
[21:39:21] jnollette: has joined #ruby
[21:39:31] dviola: zenspider: check if there are french packages for git and what not? maybe we missed some step
[21:43:10] shenghi: has joined #ruby
[21:47:07] dviola: sudo apt-get install language-pack-XX
[21:56:36] sanscoeur: has joined #ruby
[21:57:23] zenspider: perfect. thank you
[21:57:58] BlopMonster: has joined #ruby
[21:58:04] zenspider: aaand I still can't reproduce! huh.
[21:58:15] zenspider: I'm getting french output... but no
[22:02:01] akaiiro: has joined #ruby
[22:02:43] amar: has joined #ruby
[22:04:39] chouhoul_: has joined #ruby
[22:05:17] timmow: has joined #ruby
[22:06:10] jenrzzz_: has joined #ruby
[22:07:57] zenspider: dviola: thank you. that helped. And I think showed that his PR is also bad.
[22:08:19] schneider-: has joined #ruby
[22:08:44] desperek: has joined #ruby
[22:10:41] karapetyan: has joined #ruby
[22:12:24] zenspider: uuuugh linux is a horrible monster
[22:12:30] zenspider: such an unusable mess
[22:13:11] zenspider: guess it makes sense that two of my most hated tools are done by the same person... he just shouldn't be allowed to make things that humans interface with
[22:13:38] sanscoeur: has joined #ruby
[22:14:05] havenwood: zenspider: Looking at the, ahem >.>, git status emoji script i wrote for my prompt, i check if it's latest commit differently: https://gist.github.com/havenwood/6d32985ceee909d8c1da6bebbe94d5de
[22:14:39] havenwood: zenspider: No promise it's sane. ;-P
[22:17:35] Megamos: has joined #ruby
[22:18:27] workmad3: has joined #ruby
[22:24:09] FernandoBasso: Are there any ruby books that don't teach using examples that print strings on the terminal only? Something that teaches 'ruby paradigms' using somewhat more realist examples?
[22:25:26] sanscoeur: has joined #ruby
[22:27:23] ramfjord: has joined #ruby
[22:31:37] dviola: zenspider: yw
[22:32:12] akaiiro: has joined #ruby
[22:36:04] sanscoeur: has joined #ruby
[22:36:11] weird_error: has joined #ruby
[22:44:13] BlopMonster: has joined #ruby
[22:47:59] mikecmpbll: has joined #ruby
[22:48:00] cthulchu: folks, I'm sorry for asking, but what's the difference between require and require_parent?
[22:48:23] cthulchu: I have a subtle feeling that require_parent has a hint of OOP to it
[22:48:31] havenwood: cthulchu: The latter isn't a thing in Ruby itself.
[22:48:53] cthulchu: what is it?
[22:48:59] havenwood: cthulchu: Are you thinking require_relative maybe?
[22:49:12] cthulchu: oh, yes, sorry
[22:49:17] cthulchu: it's _relative
[22:49:48] cthulchu: ha, it's not the relative I was thinking about :)
[22:49:51] havenwood: chamunks: require will go through $LOAD_PATH directories and try to find the file
[22:50:12] cthulchu: that's for me
[22:51:00] havenwood: cthulchu: require_relative ignores the $LOAD_PATH and is instead relative to the path of the file
[22:51:19] cthulchu: will use relative then
[22:51:51] havenwood: cthulchu: For fun, here's a require_relative that enables tail call optimization for the file you're requiring: https://gist.github.com/havenwood/3c5a5e1476c811460992
[22:52:20] nicht: has joined #ruby
[22:52:28] havenwood: I should change that to an optional kwarg: with_tco: true
[22:52:42] havenwood: Or maybe?: with_tailcall_optimization: true
[22:52:44] cthulchu: you should add a few lines of readme
[22:52:50] cthulchu: and comments
[22:52:56] havenwood: I guess tail and call are two words.
[22:53:08] havenwood: cthulchu: good points
[22:53:15] cthulchu: I don't know what tail call is
[22:53:32] havenwood: cthulchu: If you do recursive calls, where a method calls itself, the Ruby stack only goes so deep.
[22:53:50] cthulchu: only goes so deep?
[22:53:53] havenwood: cthulchu: So if you say implement a recursive fibonacci sequence, it'll explode when it gets too deep.
[22:53:54] cthulchu: how deep does it go?
[22:54:04] cthulchu: it's unfair
[22:54:05] havenwood: cthulchu: That depends on the implementation of Ruby.
[22:54:08] cthulchu: how does it explode?
[22:54:12] cthulchu: stack overflow?
[22:54:20] havenwood: cthulchu: Stack Level Too Deep, STACK OVERFLOW!
[22:54:30] havenwood: Your stack runneth over.
[22:54:32] cthulchu: it happens everywhere
[22:54:42] cthulchu: what relation does it have to require though?
[22:55:13] havenwood: cthulchu: That little method I wrote requires but then loads the required code with trace disabled and tco enabled.
[22:55:42] cthulchu: okay, it's too complex to comprehend.
[22:55:49] havenwood: cthulchu: So you can recurse over and over and it'll use constant stack space.
[22:56:05] cthulchu: doesn't it use constant stack space anyway?
[22:56:23] havenwood: sec, I'll write an example
[22:56:44] cthulchu: you should write it right there for other peeps to see
[22:58:41] sanscoeur: has joined #ruby
[22:59:01] cthulchu: if I require A and don't create an object of A in this class B (although I can) and then I extend B with C, will I have access to A in C?
[22:59:14] eckhardt: has joined #ruby
[22:59:14] venmx: has joined #ruby
[22:59:23] cthulchu: or should I create an object of A in B to refer to A when in C?
[23:07:51] cthulchu: okay, I will have an object.
[23:07:54] cthulchu: Just in case.
[23:08:37] jenrzzz: has joined #ruby
[23:13:48] eckhardt: has joined #ruby
[23:16:15] akaiiro: has joined #ruby
[23:18:20] wontruefree: has joined #ruby
[23:18:58] cthulchu: ok, folks, help me to understand this code...
[23:19:47] cthulchu: https://pastebin.com/7pMQPNmn
[23:19:48] ruby[bot]: cthulchu: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[23:20:29] cthulchu: https://gist.github.com/bnazaruk/3bfe4e333c403abd95a13191ae6da98d
[23:20:35] cthulchu: wonderful...
[23:20:44] cthulchu: use pastebin instead
[23:20:49] cthulchu: https://pastebin.com/7pMQPNmn
[23:20:49] ruby[bot]: cthulchu: as I told you already, please use https://gist.github.com
[23:22:21] cthulchu: this looks good: https://paste.ofcode.org/32BTMszzjtRiCmvKsfLQD2y
[23:22:41] amatas: has joined #ruby
[23:22:44] cthulchu: I don't understand how the Driver_wrapper is being set
[23:30:15] nicht: has joined #ruby
[23:30:32] cthulchu: how do we continue after binding.pry
[23:35:15] cthulchu: I guess we don't continue
[23:37:53] za1b1tsu: has joined #ruby
[23:42:30] eckhardt: has joined #ruby
[23:50:01] wontruefree: has joined #ruby
[23:51:48] GodFather: has joined #ruby
[23:52:48] Megamos: has joined #ruby
[23:52:49] jrafanie: has joined #ruby
[23:54:36] cthulchu: okay, I'll ask about it tomorrow
[23:55:38] karapetyan: has joined #ruby
[23:56:03] gix: has joined #ruby
[23:57:02] karapetyan: has joined #ruby
[23:57:43] nicht_: has joined #ruby