« Back to channel list

#ruby - 13 May 2016

« Back 1 day Forward 1 day »
[00:00:20] blackmesa: has joined #ruby
[00:01:12] benzrf: cooldavid: im not familiar with this api & im busy
[00:01:32] bronson: has joined #ruby
[00:01:44] djbkd: has joined #ruby
[00:02:12] Hanmac: has joined #ruby
[00:02:20] djbkd: has joined #ruby
[00:03:55] weaksauce: cooldavid make payments_collected_in return the correct number of payments collected
[00:06:14] djbkd: has joined #ruby
[00:06:26] cooldavid: not sure where I'm going to get that from
[00:06:41] cooldavid: that's the only data I have
[00:06:58] weaksauce: the data is there from what you are inputting
[00:07:06] djbkd: has joined #ruby
[00:07:35] weaksauce: you need to query the db and calculate the payments
[00:08:07] cooldavid: yes but how do you calculate that, that's the thing I'm having problem with
[00:11:18] idefine: has joined #ruby
[00:17:04] |ifei5good: has joined #ruby
[00:18:29] jaguarmagenta: has joined #ruby
[00:21:42] Pharaoh2: has joined #ruby
[00:22:07] Pharaoh2: has joined #ruby
[00:25:32] slackbotgz: has joined #ruby
[00:25:39] papachan: has joined #ruby
[00:26:08] Hanmac: has joined #ruby
[00:26:51] jaguarma_: has joined #ruby
[00:27:10] roshanavand: has joined #ruby
[00:28:19] Madplatypus: has joined #ruby
[00:29:24] joaumg: has joined #ruby
[00:31:27] ensyde: has joined #ruby
[00:32:17] nankyokusei: has joined #ruby
[00:32:51] cooldavid: if Date is my only input, how I'm supposed to get the correct number of payments with only that info?
[00:33:14] idefine: has joined #ruby
[00:37:57] jhack: has joined #ruby
[00:40:20] dgncn: has joined #ruby
[00:40:41] CloCkWeRX: has joined #ruby
[00:40:50] idefine: has joined #ruby
[00:41:54] djcp: has joined #ruby
[00:43:19] zotherstupidguy: has joined #ruby
[00:45:20] ledestin: has joined #ruby
[00:47:51] exadeci: has joined #ruby
[00:48:44] cdg: has joined #ruby
[00:51:11] jaguarmagenta: has joined #ruby
[00:53:11] jaguarma_: has joined #ruby
[00:54:39] idefine: has joined #ruby
[00:54:42] gigetoo: has joined #ruby
[00:54:44] hahuang61: has joined #ruby
[00:58:03] halfamind: has joined #ruby
[00:58:46] DissonantGuil3: has joined #ruby
[01:00:45] edwinvdgraaf: has joined #ruby
[01:01:34] DissonantGuil3: Any way to evaluate a ruby file into new Proc so I can call it later in a given binding?
[01:05:33] panpainter: has joined #ruby
[01:07:04] roamingdog: has joined #ruby
[01:07:37] bmurt: has joined #ruby
[01:10:32] Yiota: has joined #ruby
[01:12:53] robbyoconnor: has joined #ruby
[01:13:11] jaguarmagenta: has joined #ruby
[01:14:40] idefine: has joined #ruby
[01:16:07] bronson: has joined #ruby
[01:18:43] RegulationD: has joined #ruby
[01:18:51] Hanmac: has joined #ruby
[01:19:00] DissonantGuil3: nvm it's just Proc.new { eval(code) }
[01:23:04] fedexo: has joined #ruby
[01:24:13] janebootydoe2: has joined #ruby
[01:25:44] matp: has joined #ruby
[01:29:13] jaguarmagenta: has joined #ruby
[01:29:29] kareeoleez: has joined #ruby
[01:34:13] roamingdog: has joined #ruby
[01:34:31] jaguarma_: has joined #ruby
[01:34:34] karmatr0n: has joined #ruby
[01:36:01] edwinvdgraaf: has joined #ruby
[01:37:49] jaguarmagenta: has joined #ruby
[01:37:51] janebootydoe: has joined #ruby
[01:38:20] Ropeney: has joined #ruby
[01:41:26] chipotle: has joined #ruby
[01:45:11] halfamind: has joined #ruby
[01:46:09] halfamind1: has joined #ruby
[01:46:29] idefine: has joined #ruby
[01:46:34] halfamind: has joined #ruby
[01:47:11] jaguarmagenta: has joined #ruby
[01:48:24] cooldavid: I got it to pass with this: https://gist.github.com/anonymous/f7f48779bc5ce747ae87e7b497d6bd6d
[01:48:43] cooldavid: but I think this is cheating
[01:49:19] banister: has joined #ruby
[01:51:09] cooldavid: weaksauce: ^
[01:51:55] halfamind1: has joined #ruby
[01:52:39] raeoks: has joined #ruby
[01:53:15] roamingdog: has joined #ruby
[01:53:54] Vingador: has joined #ruby
[01:57:35] kasisnu_: has joined #ruby
[01:57:54] duncannz: has joined #ruby
[01:59:34] MiniFrenchBread: has joined #ruby
[02:00:37] dikaio: has joined #ruby
[02:00:49] rbennacer: has joined #ruby
[02:02:15] roamingdog: has joined #ruby
[02:03:48] blackmesa: has joined #ruby
[02:04:38] pawnbox: has joined #ruby
[02:05:23] panpainter: has joined #ruby
[02:09:35] majuscule: has joined #ruby
[02:09:53] kenichi: has joined #ruby
[02:12:53] ensyde__: has joined #ruby
[02:15:08] roamingdog: has joined #ruby
[02:16:20] eam: has joined #ruby
[02:18:28] Junaos: has joined #ruby
[02:18:56] nando293921: has joined #ruby
[02:19:44] halfamind: has joined #ruby
[02:19:50] idefine: has joined #ruby
[02:20:34] rcs: has joined #ruby
[02:21:27] nando293921: has joined #ruby
[02:24:01] bigfoot111: has joined #ruby
[02:25:29] Ropeney: has joined #ruby
[02:25:32] Channel6: has joined #ruby
[02:30:46] roamingdog: has joined #ruby
[02:33:12] nankyokusei: has joined #ruby
[02:34:14] araujo_: has joined #ruby
[02:36:37] halfamind1: has joined #ruby
[02:37:10] edwinvdgraaf: has joined #ruby
[02:40:21] pawnbox: has joined #ruby
[02:47:49] joneshf-laptop: has joined #ruby
[02:49:10] hahuang61: has joined #ruby
[02:50:32] mistermocha: has joined #ruby
[02:51:04] kasisnu: has joined #ruby
[02:51:44] jancel: has joined #ruby
[02:57:46] SilverKey: has joined #ruby
[03:03:09] Hanmac: has joined #ruby
[03:05:53] blackmesa: has joined #ruby
[03:06:12] marienz: has joined #ruby
[03:08:54] zast: has joined #ruby
[03:09:01] statelesscode: has joined #ruby
[03:09:08] Hanmac: has joined #ruby
[03:10:57] braincrash: has joined #ruby
[03:13:08] stardiviner: has joined #ruby
[03:15:19] allcentury: has joined #ruby
[03:16:16] pawnbox: has joined #ruby
[03:17:05] idefine: has joined #ruby
[03:17:16] Dry_Lips: has joined #ruby
[03:17:16] Dry_Lips: has joined #ruby
[03:19:05] edwinvdgraaf: has joined #ruby
[03:19:13] gix: has joined #ruby
[03:19:19] rikai: has joined #ruby
[03:19:20] nwhirschfeld: has joined #ruby
[03:19:38] tubbo: has joined #ruby
[03:22:10] jancel: has joined #ruby
[03:25:06] LoneHermit: has joined #ruby
[03:26:04] halfamind: has joined #ruby
[03:27:11] halfamind1: has joined #ruby
[03:27:53] Devalo: has joined #ruby
[03:28:51] karmatr0n: has joined #ruby
[03:34:24] roamingdog: has joined #ruby
[03:39:08] elavee: has joined #ruby
[03:39:24] elavee: ruby is great
[03:39:57] horaceheaven: has joined #ruby
[03:53:43] noService: has joined #ruby
[03:53:57] noService: has joined #ruby
[03:57:57] agent_white: has joined #ruby
[04:00:54] ramfjord: has joined #ruby
[04:01:01] djbkd: has joined #ruby
[04:01:22] jenrzzz: has joined #ruby
[04:01:22] jenrzzz: has joined #ruby
[04:02:55] tatsuo: has joined #ruby
[04:04:13] kies: has joined #ruby
[04:05:10] kgrz: has joined #ruby
[04:05:31] Eiam_: has joined #ruby
[04:05:36] jaguarmagenta: has joined #ruby
[04:06:36] blackmesa: has joined #ruby
[04:13:15] yfeldblum: has joined #ruby
[04:13:24] kareeoleez: has joined #ruby
[04:14:24] kareeoleez: has joined #ruby
[04:15:55] Vile`: has joined #ruby
[04:18:01] tildes: has joined #ruby
[04:18:46] pawnbox: has joined #ruby
[04:21:01] edwinvdgraaf: has joined #ruby
[04:25:50] halfamind: has joined #ruby
[04:26:45] A124: has joined #ruby
[04:30:15] lomex: has joined #ruby
[04:34:02] nankyokusei: has joined #ruby
[04:34:05] pawnbox: has joined #ruby
[04:34:20] antgel: has joined #ruby
[04:40:23] ereslibre: has joined #ruby
[04:40:52] Yiota: has joined #ruby
[04:43:00] jimism: has joined #ruby
[04:47:15] mistermocha: has joined #ruby
[04:48:39] Devalo: has joined #ruby
[04:51:57] raeoks: has joined #ruby
[04:55:11] edwinvdgraaf: has joined #ruby
[04:56:44] ecksit: has joined #ruby
[04:57:57] ecksit: hi, i'm wondering how i would go about doing the following PHP snippet in ruby? `print $myobj->{$myval};` where it would first evaluate the value of $myval and then be usable as a method
[04:59:35] halfamind: has joined #ruby
[05:03:51] ecksit: i've found eval but i'm not sure if that is the best approach
[05:04:39] nwhirschfeld: has joined #ruby
[05:04:49] tubbo: has joined #ruby
[05:05:40] rikai: has joined #ruby
[05:06:11] nertzy: has joined #ruby
[05:07:12] panpainter: has joined #ruby
[05:07:22] blackmesa: has joined #ruby
[05:09:00] Yiota: has joined #ruby
[05:09:50] crystal77: has joined #ruby
[05:10:08] diegoaguilar: has joined #ruby
[05:16:09] sauvin: has joined #ruby
[05:18:55] kgrz: ecksit: something like myobj.send(myval) should work™
[05:19:12] ecksit: thanks, let me try that
[05:19:28] kgrz: Note that myval here should be a symbol
[05:19:32] szu: has joined #ruby
[05:19:59] dionysus69: has joined #ruby
[05:20:16] RegulationD: has joined #ruby
[05:21:02] jackjackdripper1: has joined #ruby
[05:21:18] kgrz: or a string
[05:22:36] last_staff: has joined #ruby
[05:24:25] pawnbox: has joined #ruby
[05:29:11] yfeldblum: has joined #ruby
[05:34:04] nankyokusei: has joined #ruby
[05:36:47] lxsameer: has joined #ruby
[05:37:14] Coldblackice: has joined #ruby
[05:37:46] pawnbox: has joined #ruby
[05:44:47] tatsuo: has joined #ruby
[05:45:21] Yzguy: has joined #ruby
[05:46:14] raeoks: has joined #ruby
[05:46:25] GriffinHeart: has joined #ruby
[05:46:52] cajone: has left #ruby: ()
[05:47:09] beawesomeinstead: has joined #ruby
[05:47:25] GriffinHeart: Hi everyone, is there a way to freeze a docstring?
[05:49:06] Hanmac: GriffinHeart: ruby doesn't use docstring, use rdoc or yard comment format
[05:49:19] GriffinHeart: hanmac: sorry I meant heredoc
[05:49:27] Arcaire: GriffinHeart: a heredoc is just a string
[05:49:40] bluOxigen: has joined #ruby
[05:49:44] GriffinHeart: `BLEH = <<-EOF something EOF`
[05:50:50] Hanmac: there is a comment for freezing string literals, but i remember it correctly
[05:50:58] GriffinHeart: Oh I found it, was trying to do it like `BLEH = <<-EOF something EOF.freeze` but its `BLEH = <<-EOF.freeze something EOF` (with the appropriate line breaks)
[05:51:30] dikaio: has joined #ruby
[05:53:25] aufi: has joined #ruby
[05:53:58] cajone: has joined #ruby
[05:54:36] jwren: has joined #ruby
[05:56:21] edwinvdgraaf: has joined #ruby
[05:58:22] Hanmac: shevy: checkout this: its about today's special day ;P
[05:58:22] Hanmac: >> (1616..2616).flat_map {|y| (1..12).map {|m| Date.new(y,m,13).wday }}.group_by(&:itself).map {|k,v| [k,v.size]}.sort_by(&:last)
[05:58:24] ruby[bot]: hanmac: # => uninitialized constant Date ...check link for more (https://eval.in/570448)
[05:58:32] Hanmac: >> require "date"; (1616..2616).flat_map {|y| (1..12).map {|m| Date.new(y,m,13).wday }}.group_by(&:itself).map {|k,v| [k,v.size]}.sort_by(&:last)
[05:58:33] ruby[bot]: hanmac: # => [[4, 1710], [6, 1712], [1, 1714], [2, 1714], [0, 1719], [3, 1721], [5, 1722]] (https://eval.in/570449)
[05:59:54] fedexo: has joined #ruby
[05:59:55] Hanmac: means in 1000 years, there are 12 more Friday the 13th than Thursday the 13th ;P
[06:02:18] ur5us: has joined #ruby
[06:02:51] pawnbox: has joined #ruby
[06:04:59] fedexo: has joined #ruby
[06:05:11] kareeoleez: has joined #ruby
[06:06:41] kareeoleez: has joined #ruby
[06:06:46] jwren: has joined #ruby
[06:06:52] pawnbox: has joined #ruby
[06:07:11] apofis: has joined #ruby
[06:08:26] blackmesa: has joined #ruby
[06:10:10] howdoi: has joined #ruby
[06:10:25] agit0: has joined #ruby
[06:12:04] d0lph1n98: has joined #ruby
[06:13:13] Hanmac: has joined #ruby
[06:15:18] jwren_: has joined #ruby
[06:17:59] noobsu: has joined #ruby
[06:20:28] ferr: has joined #ruby
[06:24:50] tagaulap: has joined #ruby
[06:25:53] yeticry: has joined #ruby
[06:25:56] PlasmaStar: has joined #ruby
[06:26:10] firstdayonthejob: has joined #ruby
[06:29:30] noobsu: has joined #ruby
[06:29:51] bruno-: has joined #ruby
[06:30:48] djbkd: has joined #ruby
[06:34:34] ravishankarjha: has joined #ruby
[06:35:03] yfeldblum: has joined #ruby
[06:37:23] edwinvdgraaf: has joined #ruby
[06:38:21] weaksauce: cooldavid of course that's cheating
[06:39:52] pawnbox: has joined #ruby
[06:40:58] Macaveli: has joined #ruby
[06:41:45] sinkensabe: has joined #ruby
[06:46:52] noobsu: has joined #ruby
[06:49:20] codecop: has joined #ruby
[06:49:59] agit0: has joined #ruby
[06:50:41] MiniFrenchBread: has joined #ruby
[06:57:15] LoneHerm_: has joined #ruby
[06:58:16] ctp: has joined #ruby
[06:58:44] bazzy: does ruby really not have `"true" if true else "false"` syntax? namely, the "else" part
[06:58:51] bazzy: (one-liner)
[06:59:27] noobsu: has joined #ruby
[06:59:27] vondruch: has joined #ruby
[07:00:49] jaruga___: has joined #ruby
[07:02:34] noark9: has joined #ruby
[07:03:09] zyzioziom: has joined #ruby
[07:03:55] agent_white: bazzy: return bob || fred
[07:04:44] agent_white: bob ? "BAHB" : "fred"
[07:04:51] bazzy: thanks boss
[07:05:18] agent_white: I actually just learned the first one the other day myself.
[07:06:23] yfeldblum: has joined #ruby
[07:07:20] bazzy: agent_white, not sure how that would translate to something like `user = m.user.authname if m.user.authed? else m.user`
[07:07:45] panpainter: has joined #ruby
[07:07:49] sinkensabe: has joined #ruby
[07:09:34] blackmesa: has joined #ruby
[07:10:29] aganov: has joined #ruby
[07:10:29] agent_white: bazzy: I would use the ternary operator
[07:10:39] Devalo: has joined #ruby
[07:10:50] TomyWork: has joined #ruby
[07:11:14] noobsu: has joined #ruby
[07:11:20] agent_white: bazzy: is_true? (?) then; do this; : else;do;this
[07:11:30] biberu: has joined #ruby
[07:11:43] agent_white: bazzy: m.user.authed? ? m.user.authname : m.user
[07:12:03] Mia: has joined #ruby
[07:12:03] Mia: has joined #ruby
[07:12:04] bazzy: that's the syntax I've forgotten. Thanks!
[07:12:07] bazzy: agent_white, ^
[07:12:59] agent_white: I wonder if you can parens around the inside '?'
[07:13:07] agent_white: make it like a question balloon
[07:13:16] brunto: has joined #ruby
[07:14:51] Miron: has joined #ruby
[07:15:06] mark_66: has joined #ruby
[07:15:43] edwinvdgraaf: has joined #ruby
[07:16:27] GriffinHeart: has joined #ruby
[07:20:29] sulky_: has joined #ruby
[07:25:48] sinkensabe: has joined #ruby
[07:26:35] anisha: has joined #ruby
[07:26:53] karmatr0n: has joined #ruby
[07:29:58] ensyde__: has joined #ruby
[07:32:10] CloCkWeRX: has joined #ruby
[07:32:18] bruno-: has joined #ruby
[07:33:49] sinkensabe: has joined #ruby
[07:37:41] lulzmachine_: has joined #ruby
[07:38:05] symm-: has joined #ruby
[07:40:02] sepp2k: has joined #ruby
[07:43:19] lessless: has joined #ruby
[07:45:33] ur5us: has joined #ruby
[07:48:07] Yiota: has joined #ruby
[07:49:46] p0p0pr37_: has joined #ruby
[07:51:34] kareeole_: has joined #ruby
[07:53:16] pawnbox: has joined #ruby
[07:55:22] kareeoleez: has joined #ruby
[07:55:54] Yiota: has joined #ruby
[07:56:08] akem: has joined #ruby
[07:56:42] yfeldblum: has joined #ruby
[07:56:49] PlasmaStar: has joined #ruby
[07:57:31] Dimik: has joined #ruby
[07:58:00] neanderslob: has joined #ruby
[07:58:41] _aeris_: has joined #ruby
[07:59:08] dikaio: has joined #ruby
[07:59:22] siovene: has joined #ruby
[07:59:22] troulouliou_div2: has joined #ruby
[07:59:27] aswen: has joined #ruby
[07:59:52] sinkensabe: has joined #ruby
[08:00:31] roamingdog: has joined #ruby
[08:01:26] nankyokusei: has joined #ruby
[08:01:27] Hobbyboy: has joined #ruby
[08:02:47] Yiota: has joined #ruby
[08:04:12] sinkensa_: has joined #ruby
[08:04:43] terlar: has joined #ruby
[08:05:06] tvw: has joined #ruby
[08:05:26] marr: has joined #ruby
[08:06:29] Madplatypus: has joined #ruby
[08:09:08] neanderslob: has joined #ruby
[08:09:54] ReK2: has joined #ruby
[08:10:17] blackmesa: has joined #ruby
[08:10:57] Janno: has joined #ruby
[08:12:12] Devalo: has joined #ruby
[08:13:28] evidex: has joined #ruby
[08:13:51] ICantCook: has joined #ruby
[08:14:09] Macaveli: has joined #ruby
[08:15:21] dikaio: has joined #ruby
[08:19:56] blaxter: has joined #ruby
[08:21:09] j_mcnally: has joined #ruby
[08:21:17] syndikate: has joined #ruby
[08:21:43] pawnbox: has joined #ruby
[08:21:50] tatsuo: has joined #ruby
[08:26:29] nischay: has joined #ruby
[08:27:53] karmatr0n: has joined #ruby
[08:28:26] itgone: has joined #ruby
[08:37:44] startupality: has joined #ruby
[08:39:07] blackmesa: has joined #ruby
[08:42:05] jgt1: has joined #ruby
[08:43:35] d0nn1e: has joined #ruby
[08:45:24] neanderslob: has joined #ruby
[08:46:23] aupadhye: has joined #ruby
[08:51:28] quakephil: has joined #ruby
[08:51:54] skade: has joined #ruby
[08:54:18] shibly: has joined #ruby
[08:54:43] DoubleMalt: has joined #ruby
[08:54:56] araujo: has joined #ruby
[08:56:42] joneshf-laptop: has joined #ruby
[09:00:41] roamingdog: has joined #ruby
[09:01:06] araujo: has joined #ruby
[09:01:07] akem: has joined #ruby
[09:02:42] jgt1: has joined #ruby
[09:04:23] bruce_lee: has joined #ruby
[09:04:23] bruce_lee: has joined #ruby
[09:07:32] matp: has joined #ruby
[09:08:14] panpainter: has joined #ruby
[09:09:23] sinkensabe: has joined #ruby
[09:09:43] grassass: has joined #ruby
[09:13:39] Macaveli: has joined #ruby
[09:15:21] Caerus|Away: has joined #ruby
[09:16:02] tvw: has joined #ruby
[09:17:31] d0lph1n98: has joined #ruby
[09:20:23] mdw: has joined #ruby
[09:20:31] sinkensabe: has joined #ruby
[09:21:21] ur5us: has joined #ruby
[09:21:54] RegulationD: has joined #ruby
[09:23:34] sinkensabe: has joined #ruby
[09:25:24] shibly: has left #ruby: ("Leaving")
[09:26:45] sinkensabe: has joined #ruby
[09:26:51] LoneHerm_: has joined #ruby
[09:27:33] toretore: has joined #ruby
[09:29:01] Yiota: has joined #ruby
[09:29:09] jaguarmagenta: has joined #ruby
[09:30:29] zyzioziom: has joined #ruby
[09:32:21] giz|work: has joined #ruby
[09:35:06] yfeldblum: has joined #ruby
[09:35:46] arup_r: has joined #ruby
[09:37:06] Yiota: has joined #ruby
[09:37:06] Bish: hi folks, what's the difference between def x(a:1).. and def x(a=1)...
[09:37:28] ohcibi: has joined #ruby
[09:37:38] Hanmac: Bish: 1) key arguments 2) default arguments
[09:37:44] arup_r: first 1 is keyword argument
[09:37:47] jds: has joined #ruby
[09:37:55] arup_r: oh answer gives=n!
[09:38:17] Bish: okay, hm, what is key argument syntax? what is it good for?
[09:38:22] platzhirsch: has joined #ruby
[09:38:41] Bish: i got something like def x a=1,b=2,c=3, i search a way to call x with a value for C but not change a,b defaults
[09:39:06] Bish: tried to use the double splat operator for that.. didn't work, unless i use the key notation, which i don't quite understand
[09:39:59] nischay_: has joined #ruby
[09:40:16] Bish: i thinki i get it
[09:41:42] Bish: they're disjunct ways to give functions arguments
[09:41:48] Bish: i get it, they're not compatible
[09:42:05] Bish: since when is key argument list a thing? i mean versions
[09:43:36] itguru: has joined #ruby
[09:45:14] itguru: I started to learn ruby yesterday to write something that does some lookups, and extracts the ip addresses returned into a file — how — I'm currently drinking from the firehose called google search, and it's killing me. I'm loving it, but… well, ruby is too damn flexible. in bash, i would just run sed on the strings to get them back, but would would be the ruby approach?
[09:45:55] Bish: itguru: get the data into a string and use it's scan method
[09:47:10] Bish: >> "peter:maffay julia:roberts".scan(/([^\s]+):([^\s]+)/)
[09:47:11] ruby[bot]: Bish: # => [["peter", "maffay"], ["julia", "roberts"]] (https://eval.in/570718)
[09:47:28] Bish: as an example
[09:47:37] karmatr0n: has joined #ruby
[09:47:44] Bish: how you can easily exctract data out of a string
[09:48:43] itguru: Thanks Bish — That looks like what I need, I was running into examples where I would only get the first match, there are multiple ips in the string
[09:48:59] itguru: I will now go and struggle with that
[09:51:42] Bish: >> "1.2.3.4 5.5.5.5 133.255.255.255".scan /\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/
[09:51:43] ruby[bot]: Bish: # => ["1.2.3.4", "5.5.5.5", "133.255.255.255"] (https://eval.in/570721)
[09:52:16] eljimbo: has joined #ruby
[09:52:58] roamingdog: has joined #ruby
[09:57:32] wigust: has joined #ruby
[10:02:18] nankyokusei: has joined #ruby
[10:02:20] last_staff: has joined #ruby
[10:07:06] lessless: has joined #ruby
[10:08:00] ravishankarjha: has joined #ruby
[10:10:11] Masonn: has joined #ruby
[10:11:19] VaibhavRajput: has joined #ruby
[10:11:25] VaibhavRajput: has left #ruby: ()
[10:12:55] charliesome: has joined #ruby
[10:14:40] Devalo: has joined #ruby
[10:16:59] sdothum: has joined #ruby
[10:17:25] pandaant: has joined #ruby
[10:17:31] roshanavand: has joined #ruby
[10:17:48] sepp2k: has joined #ruby
[10:24:30] noobsu: has joined #ruby
[10:24:49] kareeoleez: I want to parse output from ifconfig, do you have any parser to suggest ?
[10:30:40] kalleth: regex :trollface:
[10:32:38] hk238: has joined #ruby
[10:33:21] itguru: has joined #ruby
[10:35:02] chipotle: has joined #ruby
[10:36:06] Hanmac: has joined #ruby
[10:36:39] gnufied: has joined #ruby
[10:37:26] pawnbox: has joined #ruby
[10:44:10] ur5us: has joined #ruby
[10:47:48] roshanavand1: has joined #ruby
[10:48:49] umdstu: has joined #ruby
[10:52:26] roshanavand1: has joined #ruby
[10:52:45] sdothum: has joined #ruby
[10:54:20] jgt1: has joined #ruby
[10:54:27] blaxter: has joined #ruby
[10:55:38] dvinciguerra: has joined #ruby
[10:58:21] roshanavand1: has joined #ruby
[10:58:55] startupality: has joined #ruby
[10:59:25] ctp: has joined #ruby
[11:00:18] eljimbo: has joined #ruby
[11:00:46] Ishido: has joined #ruby
[11:02:16] bruno-: has joined #ruby
[11:04:35] roshanavand1: has joined #ruby
[11:04:43] moeabdol: has joined #ruby
[11:06:22] araujo: has joined #ruby
[11:06:23] araujo: has joined #ruby
[11:07:50] araujo: has joined #ruby
[11:08:39] startupality: has joined #ruby
[11:08:56] rodfersou: has joined #ruby
[11:09:28] arup_r: I asked #bundler, but that channel is not responding, so thought to ask here. What is the difference between `bundle update gemname` and `bundle update --source gemname` ?
[11:09:43] roshanavand1: has joined #ruby
[11:09:51] arup_r: main, I know how the first one works.. not sure about the second one.
[11:10:07] arup_r: s/main/mainly
[11:10:11] johnmilton: has joined #ruby
[11:12:04] FernandoBasso: has joined #ruby
[11:15:20] Bish: kareeoleez: how about not getting the information from ifconfig
[11:15:34] Bish: some file in /proc /sys
[11:15:41] kareeoleez: Bish: I've tried Socket, network_interface etc.
[11:15:55] Bish: wait, i wrote something a while ago, let's see if i can find it
[11:16:00] stardiviner: has joined #ruby
[11:17:04] roshanavand1: has joined #ruby
[11:18:10] Bish: kareeoleez: what information do you actually need from ifconfig
[11:18:23] kareeoleez: Bish: everything :P
[11:18:32] kareeoleez: Bish: I am currently writing a parser myself
[11:18:48] Bish: /proc/net/dev gives u some stats aobut interfaces
[11:18:58] kareeoleez: I tried parslet but I find it a bit complicated
[11:19:04] kareeoleez: Bish: I'm on BSD
[11:19:10] Bish: oh, no clue then
[11:21:44] madgen: has joined #ruby
[11:21:50] Bish: lol, ifocnfig uses ioctl to get ip of interfaces
[11:22:00] Bish: why the fuck does it have to be so comlicated, geez
[11:22:32] andywww: has joined #ruby
[11:22:56] andywww: what am i doing wrong with this simple array concatenation?
[11:22:58] andywww: https://gist.github.com/anonymous/093e7dc87ea18937120fcef1e98653bf
[11:23:05] andywww: its pluralising everything in the final array
[11:23:24] startupality: has joined #ruby
[11:23:37] kareeoleez: Bish: I am not familliar with the usage of ioctl actually but I'd like to
[11:24:04] Bish: kareeoleez: well, ruby out of the box won't be able to do that, no clue if there is some fancy gem that does that
[11:24:22] Bish: https://rubygems.org/gems/rethtool/versions/0.0.5
[11:24:31] kareeoleez: Bish: how do you start with ioctl and ruby ?
[11:25:15] Bish: as i said, ruby out of the box won't be able to do that ( im guessing that, relatively sure )
[11:25:30] Vile`: has joined #ruby
[11:26:14] Bish: http://stackoverflow.com/questions/19503446/get-wifi-bssid-programmatically-using-ruby-and-ioctl this looks interesting though
[11:26:24] Bish: but for wifi actually
[11:26:46] vzeqi: has joined #ruby
[11:28:03] horaceheaven: has joined #ruby
[11:28:05] jhass: andywww: String#<< modifies the original string, it does not create a copy
[11:28:13] jhass: andywww: you're looking for String#+
[11:28:25] Bish: maybe parsing ifconfig isn't such a bad idea after all
[11:28:27] andywww: yup just sussed it
[11:28:36] andywww: has left #ruby: ()
[11:28:41] Bish: and off he goes
[11:28:59] kareeoleez: Bish: thanks!
[11:29:40] Bish: kareeoleez: http://apidock.com/ruby/Kernel/syscall
[11:29:44] Bish: this is crazy though
[11:29:57] jaguarmagenta: has joined #ruby
[11:29:59] kareeoleez: Bish: rethtool looks great
[11:30:21] kareeoleez: Bish: I am interacting a lot with hardware so the "ideal" would be to know-how with ioctl
[11:30:33] kareeoleez: Bish: but seems to me too difficult
[11:30:38] kareeoleez: I mean where do you start ?
[11:30:58] Bish: there won't be an easy way, what you're trying to do seems very special
[11:31:18] Bish: your best hope, someone already had that problem, and wrote a gem
[11:31:53] anonymouse1935: has joined #ruby
[11:32:19] WebDevB: has joined #ruby
[11:32:31] Bish: anonymouse1935: hi
[11:33:07] Bish: kareeoleez: but i was wrong, you can do ioctl with ruby
[11:33:10] pawnbox: has joined #ruby
[11:33:20] WebDevB: Hey guys, we're looking for an ad-hoc ruby on rails developer work will range from a couple of hours a month to a couple of days a month... We need someone to start yesterday haha as we've been let down.
[11:33:36] czerasz: has joined #ruby
[11:35:10] skade: has joined #ruby
[11:35:34] kareeoleez: Bish: of course you can
[11:35:40] kareeoleez: Bish: but how do you start ?
[11:35:58] Bish: well, is there something like strace for bsd?
[11:36:12] davedev24: has joined #ruby
[11:36:12] terlar: has joined #ruby
[11:36:18] Bish: track the ioctl syscalls ifconfig does to get the information you need
[11:36:28] Bish: and reproduce them with Kernel.syscall
[11:36:55] Bish: would be a wierd but cool way to dit
[11:39:03] nfk: has joined #ruby
[11:40:46] tAn: has joined #ruby
[11:41:04] anonymouse1935: has left #ruby: ("Leaving")
[11:41:14] lxsameer: has joined #ruby
[11:41:14] lxsameer: has joined #ruby
[11:44:34] Mia: has joined #ruby
[11:44:34] Mia: has joined #ruby
[11:44:53] Yeomra: has joined #ruby
[11:45:12] Bish: ACTION wonders what syscall will do on windows
[11:45:38] noService: has joined #ruby
[11:46:07] sleetdrop: has joined #ruby
[11:46:19] panpainter: has joined #ruby
[11:47:07] itguru1: has joined #ruby
[11:47:56] kareeoleez: Bish: how do you track ifconfig calls ?
[11:48:01] kareeoleez: Bish: in the .c file ?
[11:48:33] kareeoleez: ifconfig is an executable binary file
[11:48:52] aldodelgado: has joined #ruby
[11:50:21] davedev24: has joined #ruby
[11:50:42] jhass: kareeoleez: strace ?
[11:51:07] startupality: has joined #ruby
[11:51:43] kareeoleez: http://www.linuxquestions.org/questions/slackware-14/where-is-the-source-code-for-ifconfig-472171/
[11:51:46] jhass: strace -e ioctol ifconfig
[11:51:54] kareeoleez: ah BSD doesn't have strace
[11:52:12] jhass: and no equivalent? oO
[11:52:35] jhass: https://www.freebsd.org/cgi/man.cgi?query=strace&apropos=0&sektion=1&manpath=FreeBSD+8.1-RELEASE+and+Ports&format=html ?
[11:53:07] Bish: keep in mind that using syscalls wo't be very portable
[11:53:08] jhass: http://www.freebsdonline.com/content/view/912/524/
[11:53:12] kareeoleez: ktrace maybe
[11:54:45] noService: has joined #ruby
[11:54:49] govg: has joined #ruby
[11:55:10] kareeoleez: but even ktrace ifconfig creates a file ktrace.out with some gibberish
[11:55:43] j_mcnally: has joined #ruby
[11:55:54] Bish: yeah you need to filter for ioctls
[11:56:14] Bish: cat ktrace.out | grep ^ioctl
[11:56:25] araujo_: has joined #ruby
[11:56:27] nerium: has joined #ruby
[11:57:53] panpainter: has joined #ruby
[11:58:10] allcentury: has joined #ruby
[11:58:50] kareeoleez: nothing comes out
[11:59:01] LoneHerm_: has joined #ruby
[11:59:03] skade: has joined #ruby
[11:59:13] Bish: well i do't know how that ktrace file looks, use the tool that was linked before
[11:59:21] Bish: truss or whatever
[12:02:54] ldnunes: has joined #ruby
[12:03:09] banister: has joined #ruby
[12:03:10] nankyokusei: has joined #ruby
[12:03:16] Hanmac: has joined #ruby
[12:05:08] synthroid: has joined #ruby
[12:06:13] mdw: has joined #ruby
[12:06:22] raz: has joined #ruby
[12:06:45] Vile`: has joined #ruby
[12:08:36] flips: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[12:09:24] machinewar: has joined #ruby
[12:10:01] LoneHerm_: has joined #ruby
[12:10:54] machinewar: anyone know of convention for setting up mini-test in a ruby gem project? i.e. so that all of my classes are when tests run? Do I need to make a spec_helper and add to LOAD_PATH? or do you explicitly require the classes in your specs?
[12:11:15] raz: hmm, how do i set a constant on a class created via Class.new? i can't get it to work :( http://pastebin.com/6wTcrsmf
[12:11:16] ruby[bot]: raz: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/af2377e28aa788b5dddba48f3e33a4cb
[12:11:16] ruby[bot]: raz: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[12:11:18] soc42: has joined #ruby
[12:12:38] machinewar: RazorX: you can use const_set(constant_name, val)
[12:12:52] kareeoleez: can someone explain what does this "/inet (?<ipv4>[\d\.]+)/ =~ rin" do ?
[12:13:14] machinewar: if you have instance of the class then you'd do obj = Class.new; obj.class.const_set("MY_CONST", "value")
[12:13:42] machinewar: raz: ^ sorry tagged someone else
[12:13:58] raz: machinewar: oh, gonna try that
[12:14:25] machinewar: raz: then you can do stuff like obj.class::MY_CONST
[12:14:41] platzhirsch: has joined #ruby
[12:14:42] j_mcnally: has joined #ruby
[12:15:35] raz: machinewar: sadly doesn't work, still the same error: https://gist.github.com/anonymous/56cc6181bb8d45b238eefa0d154bfc0f
[12:16:06] Devalo: has joined #ruby
[12:16:46] machinewar: raz: you don't need the .new on line 9 you already have an instance
[12:16:50] machinewar: since you called .new on line 1
[12:17:01] machinewar: klass.class.const_set 'MY_CONST', Time.now
[12:17:18] raz: machinewar: same error :(
[12:17:41] raz: it seems i can set the constant in a trillion ways, but it's not seen by the methods in the class
[12:18:14] Elysia: I personally used #const_get to get the constant, I don't know if that's ideal though
[12:18:39] jhass: raz: try your original way but referencing via self.class::MY_CONST
[12:18:57] raz: jhass: you mean reference in the method like that?
[12:19:08] raz: well, i'd like to use constant like a normal constant
[12:19:11] raz: that's the whole point here ;)
[12:19:34] raz: (to minimize the syntax voodoo)
[12:19:38] jhass: iirc constant lookup is tied to the lexical scope at definition, not at execution
[12:19:54] machinewar: raz: you need to not make an instance on first line and instead open up the class
[12:20:05] machinewar: class Class def hello puts MY_CONST end end
[12:20:25] machinewar: klass = Class.const_set("MY_CONST", "val")
[12:20:35] machinewar: Class.new.hello
[12:20:36] raz: machinewar: but... wouldn't that add the const to 'Class' then?
[12:20:37] machinewar: that works for me
[12:21:12] machinewar: yes constants are defined on a class level
[12:21:15] kareeoleez: guys what does =~ mean ?
[12:21:43] jhass: kareeoleez: at the end of the day it's a method call, Object#=~, String#=~, Regexp#=~
[12:22:22] hollywood: has joined #ruby
[12:22:28] `derpy: has joined #ruby
[12:22:41] SuperTux88: has joined #ruby
[12:22:45] soahccc: has joined #ruby
[12:22:47] jhass: raz: machinewar's last version works because it's essentially the same as adding it to Object
[12:23:06] kareeoleez: jhass: can you explain ?
[12:23:15] roshanavand1: has joined #ruby
[12:23:16] raz: jhass: hm yes, but i don't see how i'd make that work with my anonymous class
[12:23:19] kareeoleez: what's the alternative
[12:23:21] raz: anyway, trying some more stuff out :)
[12:24:01] jhass: kareeoleez: http://devdocs.io/ruby~2.3/object#method-i-3D-7E http://devdocs.io/ruby~2.3/string#method-i-3D-7E http://devdocs.io/ruby~2.3/regexp#method-i-3D-7E
[12:24:33] okdas: has joined #ruby
[12:24:33] okdas: has joined #ruby
[12:24:47] jhass: raz: I think what you want is not possible (without defining the constants in the "global" (Object, Module, Class) context
[12:26:09] raz: jhass: yea i guess if i can get your method to work in my actual context, i'll be fine :)
[12:26:16] jhass: raz: a workaround could be to add a method called MY_CONST ...
[12:26:52] raz: jhass: well, at the core i just want to inject some "configuration" into the created class. it doesn't even have to be a constant, but that seemed the most natural way to define something across all instances of said class
[12:27:04] aupadhye: has joined #ruby
[12:27:18] raz: i guess a class-var would work equally well, if that is somehow easier
[12:28:17] tAn: has joined #ruby
[12:28:19] jhass: I think I'd just inject a method
[12:28:41] jhass: klass.send(:define_method, :configuration) { configuration }
[12:28:43] bauruine: has joined #ruby
[12:30:14] kareeoleez: has joined #ruby
[12:30:42] kareeoleez: jhass: thanks
[12:31:17] arup_r: has left #ruby: ()
[12:31:34] kareeoleez: jhass: I guess somthing like str.match(/ /)
[12:31:35] skade: has joined #ruby
[12:31:42] jhass: pretty much
[12:32:13] jhass: er, =~ has some weird side effects but I prefer not to use them
[12:32:31] akkmaxon: has joined #ruby
[12:32:48] Bish: what side effects?
[12:33:32] Bish: >> "abc"[/(a|b)/,1]
[12:33:33] ruby[bot]: Bish: # => "a" (https://eval.in/570848)
[12:33:36] Bish: i like this one
[12:33:43] Bish: >> "abc"[/(a|b)/,2]
[12:33:45] ruby[bot]: Bish: # => nil (https://eval.in/570849)
[12:34:13] Bish: >> "abc"[/(a|b)/,0]
[12:34:14] ruby[bot]: Bish: # => "a" (https://eval.in/570851)
[12:35:41] nadir: has joined #ruby
[12:35:48] jhass: Bish: like creating local vars for named captures when used inside an if
[12:36:17] reaVer: has joined #ruby
[12:36:29] roamingdog: has joined #ruby
[12:36:51] |2701: has joined #ruby
[12:41:04] panpainter: has joined #ruby
[12:42:16] Bish: scan / match doesn't do that?
[12:42:43] Bish: yeah that local var string is scary, and actually i guess my latest project is vulnable to injection there
[12:42:52] blackmesa: has joined #ruby
[12:42:52] Bish: s/string/thing
[12:46:25] DaniG2k: has joined #ruby
[12:46:56] startupality: has joined #ruby
[12:47:09] jancel: has joined #ruby
[12:48:35] roamingdog: has joined #ruby
[12:48:55] zyzioziom: has joined #ruby
[12:50:26] Yiota: has joined #ruby
[12:51:16] Caerus|Away: has joined #ruby
[12:51:49] startupality: has joined #ruby
[12:51:54] jhass: well, they need to be literals iirc
[12:55:18] Bish: oh, so where is the issue then?
[12:55:54] monoprotic: has joined #ruby
[12:56:29] jhass: it's IMO obscure
[12:56:31] startupality: has joined #ruby
[12:58:26] tatsuo: has joined #ruby
[12:58:41] jhass: try running this https://p.jhass.eu/1o.rb
[12:58:54] arpegius: has joined #ruby
[12:59:36] jhass: now consider the regexp to be much longer and more complex
[12:59:45] halfamind: has joined #ruby
[12:59:46] jhass: easy to shadow another local accidentially
[13:00:25] ramortegui: has joined #ruby
[13:01:20] panpainter: has joined #ruby
[13:01:51] millerti: has joined #ruby
[13:04:45] flashpoint9: has joined #ruby
[13:04:49] Bish: i tried to make use of it, because i actually liked it
[13:05:00] Bish: but i failed, because accessing them can be weird
[13:05:44] syndikate: has joined #ruby
[13:06:29] fedexo: has joined #ruby
[13:07:38] Bish: you have your own pasting service, you must have come far :D
[13:08:11] rbennacer: has joined #ruby
[13:09:24] huyderman: has joined #ruby
[13:10:50] Couch: has joined #ruby
[13:12:54] skade: has joined #ruby
[13:13:14] fmcgeough: has joined #ruby
[13:13:29] circ-user-0vXzk: has joined #ruby
[13:16:16] malconis: has joined #ruby
[13:21:09] bronson: has joined #ruby
[13:23:31] RegulationD: has joined #ruby
[13:24:04] aegis3121: has joined #ruby
[13:24:10] ChiefAlexander: has joined #ruby
[13:25:58] karmatr0n: has joined #ruby
[13:27:47] ChiefAlexander: has joined #ruby
[13:30:23] emilkarl: has joined #ruby
[13:30:43] jaguarmagenta: has joined #ruby
[13:32:00] giz|work: has joined #ruby
[13:36:26] chouhoulis: has joined #ruby
[13:37:33] pawnbox: has joined #ruby
[13:37:39] p0p0pr37_: has joined #ruby
[13:40:47] tildes: has joined #ruby
[13:42:35] crameth: has joined #ruby
[13:45:30] djbkd: has joined #ruby
[13:47:30] chipotle: has joined #ruby
[13:50:15] mjuszczak: has joined #ruby
[13:52:55] griffindy: has joined #ruby
[13:54:58] sdothum: has joined #ruby
[13:55:41] rkazak: has joined #ruby
[13:56:57] SilverKey: has joined #ruby
[13:58:48] laska: has joined #ruby
[14:01:18] cdg: has joined #ruby
[14:01:39] d0nn1e: has joined #ruby
[14:01:46] noService: has joined #ruby
[14:01:53] tAn: has joined #ruby
[14:04:01] nankyokusei: has joined #ruby
[14:04:04] bruno-: has joined #ruby
[14:05:31] idle_task: has joined #ruby
[14:05:49] freerobby: has joined #ruby
[14:06:51] dionysus69: has joined #ruby
[14:10:09] cooldavid: has joined #ruby
[14:10:45] cooldavid: is there a better/not crazy way to write this code: https://gist.github.com/anonymous/cc50a2e0dbcd497fd07080aaeca557d4
[14:11:01] cooldavid: mainly the code in payments_collected_in
[14:11:09] kareeoleez: has joined #ruby
[14:11:31] fgo: has joined #ruby
[14:11:32] diegoviola: has joined #ruby
[14:11:49] frem_: has joined #ruby
[14:11:59] monoprotic: what is it doing
[14:12:16] panpainter: has joined #ruby
[14:12:27] j_mcnally: has joined #ruby
[14:12:41] cooldavid: getting some values from the db that the spec is expecting
[14:13:04] monoprotic: i mean is there logic behind payments_collected_in
[14:13:15] cooldavid: I wrote it that way because I don't know how else to get those values
[14:13:20] chopin: has joined #ruby
[14:13:20] jobewan: has joined #ruby
[14:13:38] cooldavid: not really, or well, I don't know...
[14:13:51] Devalo: has joined #ruby
[14:14:49] chriscoffee: has joined #ruby
[14:15:57] chouhoulis: has joined #ruby
[14:16:15] karmatr0n: has joined #ruby
[14:16:19] monoprotic: cooldavid you could make a date to offset hash
[14:16:38] diego3: has joined #ruby
[14:16:40] JackMc: has joined #ruby
[14:16:43] monoprotic: {Date.new(2016, 1, 1) => 1, Date.new(2016, 2, 1) => 7, ...}
[14:16:50] blaxter: first thing to implement something is to understand the logic
[14:16:58] JackMc: Hey everyone - is there an easy way in Ruby to make something equivalent to a namedtuple in Python?
[14:17:04] JackMc: Like something that I can do thingy.size
[14:17:05] blaxter: i can't understand the logic of that neither looking at the code nor the spec
[14:17:17] blaxter: also magic numbers not a good thing
[14:17:33] shevy: what do I win
[14:18:24] momomomomo: has joined #ruby
[14:18:25] blaxter: JackMc: Struct
[14:18:37] diego4: has joined #ruby
[14:19:36] cooldavid: monoprotic: I'm supposed to find out if something can be billed for that month, but I don't know how
[14:20:11] cooldavid: monoprotic: will that require me to change the spec?
[14:20:54] zapata: has joined #ruby
[14:21:04] panpainter: has joined #ruby
[14:22:09] diego3: has joined #ruby
[14:22:17] SilverKey: has joined #ruby
[14:25:24] Masonn: has joined #ruby
[14:27:44] jancel: has joined #ruby
[14:30:38] s00pcan: has joined #ruby
[14:30:40] millerti: has joined #ruby
[14:31:37] cooldavid: right, I also don't know what I'm supposed to do, they also won't tell me so I can't know the logic
[14:32:04] cooldavid: they said it's part of guessing, or part of the exercise
[14:32:19] [Butch]: has joined #ruby
[14:32:32] charliesome: has joined #ruby
[14:32:50] shevy: sounds like prison programming
[14:33:18] JackMc: Hey everyone - I'm trying to require Mocha to get the mock() function mentioned here under 'traditional mocking': http://jamesmead.org/blog/2006-09-01-mocha-quickstart. What require should I use? I have tried require 'mocha', require 'mocha/mock', and a bunch of other stuff.
[14:33:42] kareeoleez: has joined #ruby
[14:34:17] cooldavid: shevy: yes it doesn't make sense, so I sent them something that doesn't make sense
[14:35:14] diego3: has joined #ruby
[14:35:41] rkazak: has joined #ruby
[14:37:51] imperator: has joined #ruby
[14:38:55] zast: has joined #ruby
[14:39:16] SilverKey: has joined #ruby
[14:39:57] troter__________: has joined #ruby
[14:40:12] [Butch]_: has joined #ruby
[14:43:11] dionysus69: has joined #ruby
[14:45:04] bruno-: has joined #ruby
[14:46:00] stannard: has joined #ruby
[14:46:10] agent_white: has joined #ruby
[14:48:09] ChiefAlexander: has joined #ruby
[14:49:08] dstarh: has joined #ruby
[14:51:05] Devalo: has joined #ruby
[14:52:42] lfatsm: has joined #ruby
[14:57:09] araujo: has joined #ruby
[14:57:09] araujo: has joined #ruby
[14:57:34] d10n-work: has joined #ruby
[14:58:38] araujo: has joined #ruby
[14:59:05] kareeoleez: has joined #ruby
[14:59:34] GinoManWorks: has joined #ruby
[15:01:21] huyderman: has joined #ruby
[15:02:00] mark_66: has left #ruby: ("PART #RubyOnRails :PART #elixir-lang :PART #crystal-lang :PONG :card.freenode.net")
[15:02:20] madgen: has joined #ruby
[15:02:40] idefine: has joined #ruby
[15:03:02] rbennacer: has joined #ruby
[15:03:03] idefine: has joined #ruby
[15:03:43] idefine: has joined #ruby
[15:04:27] roamingdog: has joined #ruby
[15:05:37] CloCkWeRX: has joined #ruby
[15:07:02] nando293921: has joined #ruby
[15:07:09] skade: has joined #ruby
[15:07:15] stannard: has joined #ruby
[15:08:43] ravishankarjha: has joined #ruby
[15:09:43] platzhirsch: has joined #ruby
[15:10:23] panpainter: has joined #ruby
[15:10:40] nullFxn: has joined #ruby
[15:10:43] wigust_: has joined #ruby
[15:11:54] Kus: has joined #ruby
[15:12:33] jhack: has joined #ruby
[15:13:42] jhack_: has joined #ruby
[15:13:58] TomyLobo: has joined #ruby
[15:14:04] mistermocha: has joined #ruby
[15:15:09] chouhoulis: has joined #ruby
[15:16:10] allcentury: has joined #ruby
[15:16:59] madgen: has joined #ruby
[15:18:07] codecop: has joined #ruby
[15:18:10] startupality: has joined #ruby
[15:22:58] bruno-: has joined #ruby
[15:23:31] _aeris_: has joined #ruby
[15:24:02] charliesome: has joined #ruby
[15:24:30] RegulationD: has joined #ruby
[15:24:48] momomomomo: has joined #ruby
[15:25:14] hogetaro: has joined #ruby
[15:25:19] Trynemjoel: has joined #ruby
[15:25:51] Guest00-ru: has joined #ruby
[15:25:57] isxek: has joined #ruby
[15:26:27] roamingdog: has joined #ruby
[15:27:32] skalfyfan: has joined #ruby
[15:29:10] dumdedum: has joined #ruby
[15:29:13] jancel: has joined #ruby
[15:29:59] GinoManWorks_: has joined #ruby
[15:30:29] pawnbox: has joined #ruby
[15:31:23] akem: has joined #ruby
[15:32:37] gix: has joined #ruby
[15:32:54] itguru: has joined #ruby
[15:36:47] dgynn: has joined #ruby
[15:38:53] rodferso1|lunch: has joined #ruby
[15:39:25] hwdyki: has joined #ruby
[15:40:14] j_mcnally: has joined #ruby
[15:40:17] hwdyki: has left #ruby: ()
[15:40:25] halfamind: has joined #ruby
[15:40:51] bradleesand: has joined #ruby
[15:42:03] Madmanden: has joined #ruby
[15:43:03] ponga: has joined #ruby
[15:43:22] ponga: hello people of #ruby
[15:45:12] Yiota: has joined #ruby
[15:45:48] chopin_: has joined #ruby
[15:46:24] idefine: has joined #ruby
[15:47:04] noService: has joined #ruby
[15:48:36] codecop: has joined #ruby
[15:48:47] zyzioziom: has joined #ruby
[15:48:48] momomomomo: has joined #ruby
[15:49:10] diego2: has joined #ruby
[15:52:30] idefine: has joined #ruby
[15:53:28] andikr: has joined #ruby
[15:55:26] stannard: has joined #ruby
[15:57:20] diego2: has joined #ruby
[16:02:34] halfamind1: has joined #ruby
[16:03:51] lubekpl: has joined #ruby
[16:04:03] davidmichaelkarr: has joined #ruby
[16:04:54] nankyokusei: has joined #ruby
[16:04:59] jobewan: has joined #ruby
[16:05:29] chouhoulis: has joined #ruby
[16:05:41] araujo_: has joined #ruby
[16:06:49] idefine: has joined #ruby
[16:07:05] amclain: has joined #ruby
[16:07:16] skolman_: has joined #ruby
[16:08:07] noService: has joined #ruby
[16:08:48] stannard: has joined #ruby
[16:09:00] mistermocha: has joined #ruby
[16:12:20] davidmichaelkarr: I'm trying to debug a VagrantFile used in a book (learning puppet 4). I think I'm running into issues with unexpected character handling within a HEREDOC in a Ruby script.
[16:12:35] davidmichaelkarr: The original line was this:
[16:12:37] davidmichaelkarr: sed -i -e 's#\(secure_path = .*\)$#\1:/opt/puppetlabs/bin#' /etc/sudoers
[16:13:26] davidmichaelkarr: When the script is run, I don't see an error message, but the file is not changed. I think the "#" characters are noted as comment characters by Ruby. Does that make sense?
[16:14:11] davidmichaelkarr: And the HEREDOC is initiated with this line:
[16:14:12] davidmichaelkarr: $setupscript = <<END
[16:15:03] davedev24: has joined #ruby
[16:15:52] jhass: davidmichaelkarr: easy enough to try out https://cloud.aeshna.de/u/mrzyx/screenshots/screenshot_20160513_181538.png
[16:15:53] symm-: has joined #ruby
[16:16:25] QORRiE: has joined #ruby
[16:16:35] halfamind: has joined #ruby
[16:17:45] davidmichaelkarr: jhass: So you're telling me the line should execute properly? The weird thing is, there are side effects both before and after this in the script, and they all are done, but not from this line. I then later tried running the line manually as root, and it performs the change.
[16:18:01] stannard: has joined #ruby
[16:18:15] drptbl_: has joined #ruby
[16:18:49] jhass: I can't spot anything that would affect the resulting value of the line, but if you want to verify just puts the variable
[16:19:03] antgel: has joined #ruby
[16:19:07] jhass: or yet better .inspect it
[16:19:09] roamingdog: has joined #ruby
[16:19:41] davidmichaelkarr: jhass: Sorry, I don't grok that.
[16:19:58] bradleesand: has left #ruby: ()
[16:20:36] jhass: &ri Kernel#puts Object#inspect String#inspect Kernel#p
[16:20:36] `derpy: http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-puts, http://ruby-doc.org/core-2.3.0/Object.html#method-i-inspect, http://ruby-doc.org/core-2.3.0/String.html#method-i-inspect, http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-p
[16:21:20] davidmichaelkarr: jhass: I think the point is, "what variable?" I'm running sed to modify a file.
[16:21:29] vaejor: davidmichaelkarr: do you run it the first time as root?
[16:22:04] davidmichaelkarr: vaejor: I run it with "vagrant up".
[16:22:04] kies: has joined #ruby
[16:22:07] jhass: davidmichaelkarr: $setupscript is a global variable, <<END starts a heredoc, so a string literal
[16:22:15] davidmichaelkarr: vaejor: Not as root.
[16:22:16] duoi: has joined #ruby
[16:22:24] jhass: you didn't show anything that "runs" anything
[16:22:31] vaejor: davidmichaelkarr: if you're trying to edit /etc/sudoers, you need root
[16:22:33] davidmichaelkarr: jhass: Ah, ok. print out the script variable. ok.
[16:23:18] davidmichaelkarr: vaejor: Yes, certainly, but the script (which I haven't shown), makes several mods to root-required files, with no complaint.
[16:24:04] whathappens: has joined #ruby
[16:25:13] davidmichaelkarr: If it matters, here's the excerpt from the VagrantFile that shows the entire script it runs.
[16:25:16] davidmichaelkarr: https://www.irccloud.com/pastebin/0LeCnbob/
[16:25:18] ruby[bot]: davidmichaelkarr: we in #ruby do not like irccloud.com, I reposted your paste to gist for you: https://gist.github.com/eb2f12ece621cbf061405b8cd9cc3334
[16:25:20] ruby[bot]: davidmichaelkarr: irccloud.com has no syntax highlighting, distracting formatting and loads slowly for most.
[16:26:46] zacts: 3/buffer #dragora
[16:27:24] Dell-LT_: has joined #ruby
[16:27:56] flashpoint9: has joined #ruby
[16:28:07] tatsuo: has joined #ruby
[16:29:46] blackthor: has joined #ruby
[16:30:39] mistermocha: has joined #ruby
[16:30:42] pawnbox: has joined #ruby
[16:32:21] The_Phoenix: has joined #ruby
[16:33:10] tildes: has joined #ruby
[16:34:10] idefine: has joined #ruby
[16:35:59] mistermocha: has joined #ruby
[16:39:32] idletask: has joined #ruby
[16:40:22] araujo: has joined #ruby
[16:40:22] araujo: has joined #ruby
[16:40:51] idefine: has joined #ruby
[16:43:51] mooe: has joined #ruby
[16:47:00] lacce: has joined #ruby
[16:47:17] jancel: has joined #ruby
[16:49:36] rippa: has joined #ruby
[16:50:49] crystal77: has joined #ruby
[16:53:25] dikaio: has joined #ruby
[16:54:38] lxsameer: has joined #ruby
[16:54:40] wrkrcoop: has joined #ruby
[16:54:41] arpegius: has joined #ruby
[16:54:53] wrkrcoop: there’s no way a class can be an API correct?
[16:55:00] wrkrcoop: an API refers to routes correct?
[16:55:00] symm-: has joined #ruby
[16:55:03] wrkrcoop: or endpoints
[16:55:48] jhass: API is fairly general term
[16:55:49] apeiros: an API refers to a set of function calls the operating system provides to programs to work with
[16:56:07] apeiros: ^ just one alternative definition of API
[16:56:15] apeiros: the term is quite a bit older than http
[16:56:30] jhass: let's try "an API defines a public interface for other programs to consume"
[16:56:45] jancel: has joined #ruby
[16:56:45] startupality: has joined #ruby
[16:58:11] ferr: has joined #ruby
[16:58:22] Hanmac: what about: the API is like the Index of the "Library"? ;P
[16:59:17] jhass: it's not necessarily a library
[16:59:49] firstdayonthejob: has joined #ruby
[16:59:55] idefine: has joined #ruby
[17:01:35] [diecast]: has joined #ruby
[17:01:39] djbkd: has joined #ruby
[17:01:53] deepak: has joined #ruby
[17:01:57] kapowaz: has joined #ruby
[17:02:06] ramfjord: has joined #ruby
[17:02:29] DukeDave: has joined #ruby
[17:02:51] Dimik: has joined #ruby
[17:03:23] jhill: has joined #ruby
[17:03:31] mroth_: has joined #ruby
[17:04:03] diegoaguilar: has joined #ruby
[17:04:14] wrkrcoop: has joined #ruby
[17:04:26] jpinnix_______: has joined #ruby
[17:04:27] ckrailo: has joined #ruby
[17:04:28] wrkrcoop: got disconnected.
[17:04:31] wrkrcoop: anyone answer that?
[17:04:51] ruby[bot]: You can find a log of this channel at http://irclog.whitequark.org/ruby/
[17:05:10] panpainter: has joined #ruby
[17:05:13] gizmore: has joined #ruby
[17:05:38] wrkrcoop: so creating an API class makes sense?
[17:05:56] jhass: "API class" isn't a well defined term, so maybe
[17:05:58] wrkrcoop: seems to clash with idae of web API
[17:06:01] jmhmccr: has joined #ruby
[17:06:36] elliottcable: has joined #ruby
[17:06:49] Zarthus: API's require a bit of thought before making them, perhaps you'd wish to structure what your API will contain on paper before writing something people might not like in code
[17:07:01] shinnya: has joined #ruby
[17:07:01] davidmichaelkarr: So I found a fix for my misbehaving VagrantFile script, but I'm wondering if what I found is a bug in Ruby. The original line had this string: 's#\(secure_path = .*\)$#
[17:07:05] wrkrcoop: web api is like yelp.com/users/authenticate. a class API has a method like process
[17:07:20] wrkrcoop: i just thought API referred to routes that ppl can hit
[17:07:27] davidmichaelkarr: When I printed out the resulting variable, it printed out 's#(secure_path = .*)$#
[17:07:44] davidmichaelkarr: It seemed to "dequote" the parens.
[17:07:51] incomprehensibly: has joined #ruby
[17:07:56] knowtheory: has joined #ruby
[17:08:25] davidmichaelkarr: So I looked in some docs and noted that the "#" can start variable interpolation, so I tried changing my heredoc terminator, adding single quotes around it, which is supposed to disable interpolation. That worked.
[17:08:44] jhass: good catch but that's actually not a bug but intended
[17:09:00] jhass: a normal heredoc is like double quotes
[17:09:00] davidmichaelkarr: The funny thing is, I'm definitely not doing variable interpolation here. Is Ruby somehow "swallowing" the backslash as an attempt to determine if there is variable interpolation happening?
[17:09:01] deeprave: has joined #ruby
[17:09:16] vcoinminer: has joined #ruby
[17:09:24] ruby[bot]: jhass: # => "(" (https://eval.in/571128)
[17:09:28] crystal77: has joined #ruby
[17:09:28] ruby[bot]: jhass: # => "\\(" (https://eval.in/571129)
[17:09:38] ruby[bot]: jhass: # => "\\" (https://eval.in/571130)
[17:09:53] jhass: \ is the escape character, it's interpreted inside " but not inside '
[17:09:53] dikaio: has joined #ruby
[17:10:03] madgen: has joined #ruby
[17:10:05] rflot: has joined #ruby
[17:10:12] jhass: if the escape sequence makes no sense it's simply dropped
[17:10:32] kgrz: has joined #ruby
[17:10:34] jhass: \\ is the escape sequence for a regular \ character
[17:10:41] davidmichaelkarr: jhass: Ok, so it's not variable interpolation happening, but escaping.
[17:11:18] jhass: didn't spot it either, that heredoc acts like double quotes is easy to forget
[17:11:57] crystal77: has joined #ruby
[17:13:19] ijij: has joined #ruby
[17:14:38] acalewin: has joined #ruby
[17:14:53] idefine: has joined #ruby
[17:15:06] apeiros: you can have single-quoted here-docs
[17:15:17] apeiros: simply quite the boundary marker in single quotes
[17:15:54] babblebre: has joined #ruby
[17:16:22] Yeomra: has joined #ruby
[17:16:23] apeiros: that's where you actually started :)
[17:16:24] crystal77: has joined #ruby
[17:18:11] shinnya: has joined #ruby
[17:18:27] jgt1: has joined #ruby
[17:18:59] mdw: has joined #ruby
[17:19:38] roamingdog: has joined #ruby
[17:19:52] Madmanden: has joined #ruby
[17:20:34] vdamewood: has joined #ruby
[17:21:50] linc01n: has joined #ruby
[17:22:04] synthroid: has joined #ruby
[17:22:56] err_ok: has joined #ruby
[17:23:03] bronson: has joined #ruby
[17:23:49] Madmanden: has joined #ruby
[17:24:01] riobe: has joined #ruby
[17:24:45] millerti: has joined #ruby
[17:25:48] SCHAAP137: has joined #ruby
[17:27:11] lubekpl: has joined #ruby
[17:27:17] dionysus69: has joined #ruby
[17:27:23] SilverKey: has joined #ruby
[17:27:49] Cohedrin: has joined #ruby
[17:28:07] startupality: has joined #ruby
[17:28:57] braderhart: has joined #ruby
[17:29:04] hosttor: has joined #ruby
[17:29:06] chouhoulis: has joined #ruby
[17:30:16] hayden__: has joined #ruby
[17:31:08] swgillespie: has joined #ruby
[17:31:39] angiebadillo: has joined #ruby
[17:32:38] noService: has joined #ruby
[17:33:44] stannard: has joined #ruby
[17:33:51] TheCubeLord: has joined #ruby
[17:33:59] shinnya: has joined #ruby
[17:34:35] b|ackwolf: has left #ruby: ("Leaving")
[17:34:55] idefine: has joined #ruby
[17:36:12] raeoks: has joined #ruby
[17:36:42] idefine_: has joined #ruby
[17:36:43] davidmichaelkarr: apeiros: The original script didn't quote the terminator at all. The fix was to single quote it.
[17:37:08] davidmichaelkarr: Anyway, I now have another curious issue with something from the puppet book, but I'm pretty sure this is a ruby question.
[17:37:55] umdstu: has joined #ruby
[17:38:18] davidmichaelkarr: I first noticed this unsurprising sample:
[17:38:20] davidmichaelkarr: https://gist.github.com/davidmichaelkarr/85aadf5c2fb2ffd66a3d169ae9f276f0
[17:39:07] davidmichaelkarr: However, this very similar one confuses me:
[17:39:08] davidmichaelkarr: https://gist.github.com/davidmichaelkarr/0d4926b1b5fcecda3f4783433a5e0906
[17:39:17] Majost: has joined #ruby
[17:39:29] jcp: has joined #ruby
[17:39:43] smathy: has joined #ruby
[17:40:09] davidmichaelkarr: Any idea what's going on here?
[17:40:24] duoi: has joined #ruby
[17:40:32] jimcroft: has joined #ruby
[17:40:40] last_staff: has joined #ruby
[17:41:24] mitsuhiko: has joined #ruby
[17:41:32] dvinciguerra: has joined #ruby
[17:42:41] pawnbox: has joined #ruby
[17:42:51] |2701: has joined #ruby
[17:43:15] dvinciguerra: has joined #ruby
[17:45:20] ruby[bot]: Please join #puppet for help with it.
[17:45:44] jhass: it's indeed not ruby
[17:45:52] blackmesa: has joined #ruby
[17:46:04] Madmanden: has joined #ruby
[17:46:54] jhass: anyway, !"fee" is probably false and false is not in "coffee", "fee" in "coffee" is probably true and !true is false, "tea" in "coffee" should be false then and !false is true
[17:49:54] davidmichaelkarr: jhass: Ok, I'll ask there then.
[17:53:27] Madmanden: has joined #ruby
[17:55:45] phrozen77: has joined #ruby
[17:57:44] ChiefAlexander: has joined #ruby
[17:58:55] SilverKey: has joined #ruby
[18:00:36] blaxter: has joined #ruby
[18:00:39] dima_: has joined #ruby
[18:01:40] ljames: has joined #ruby
[18:02:50] mistermocha: has joined #ruby
[18:02:54] wrkrcoop: has joined #ruby
[18:03:23] itguru: has joined #ruby
[18:04:04] dima_: has joined #ruby
[18:04:39] bestie: has joined #ruby
[18:04:51] drptbl: has joined #ruby
[18:05:20] stannard: has joined #ruby
[18:05:23] firstdayonthejob: has joined #ruby
[18:05:59] jord: has joined #ruby
[18:06:03] momomomomo: has joined #ruby
[18:06:16] dima_: has joined #ruby
[18:06:52] kareeoleez: has joined #ruby
[18:08:15] postmodern: has joined #ruby
[18:09:30] skalfyfan: has joined #ruby
[18:10:07] wigust: has joined #ruby
[18:10:08] giz|work: has joined #ruby
[18:11:16] lxsameer: has joined #ruby
[18:11:58] duoi: has joined #ruby
[18:12:26] ramfjord: has joined #ruby
[18:13:28] PlasmaStar: has joined #ruby
[18:14:04] hobodave: has joined #ruby
[18:14:32] dvinciguerra: has joined #ruby
[18:15:27] dikaio: has joined #ruby
[18:16:28] blackmes1: has joined #ruby
[18:16:48] CloCkWeRX: has joined #ruby
[18:16:54] last_staff: has joined #ruby
[18:19:42] akiTendo: has joined #ruby
[18:20:00] akiTendo: Hello all. Need a little help discovering a value.
[18:20:11] akiTendo: In a Vagrantfile (which is a ruby script)
[18:20:20] roamingdog: has joined #ruby
[18:21:03] akiTendo: The script is executing from /Users/myname/vagrants/vagrantbox/Vagrantfile
[18:21:18] akiTendo: Now in ruby, how do I get the value of directory “myname”
[18:21:28] akiTendo: Vagrantfile is the ruby script itself.
[18:21:45] akiTendo: PHP this would be dirname(dirname(dirname(__FILE__)))
[18:21:59] akiTendo: I presume it’s something similarly simple in ruby.
[18:22:36] SilverKey: has joined #ruby
[18:23:00] akiTendo: (ok, technically the above would return “/Users/myname” but I can prune down from there with a pathinfo call”
[18:23:34] adaedra: File.expand_path('../..', __dir__)
[18:24:42] adaedra: But if your goal is to get current user name, you should be able to just do `ENV['USER']`
[18:25:02] madgen: has joined #ruby
[18:25:14] apeiros: or via Etc
[18:25:23] apeiros: (the current user's name)
[18:25:30] akiTendo: adaedra: Eventually this may be invoked from ansible script ran by the administrator, not necessarily the user who is going to be using the VM.
[18:26:18] akiTendo: I think. I’ll try ENV[‘USER’] and see if that causes trouble.
[18:26:21] akiTendo: It is simpler.
[18:26:24] karmatr0n: has joined #ruby
[18:27:42] stannard: has joined #ruby
[18:29:00] adaedra: yeah, going through Etc would be more correct and reliable, but it's a bit longer.
[18:29:10] kirun: has joined #ruby
[18:30:00] rikai: has joined #ruby
[18:32:13] djbkd: has joined #ruby
[18:33:02] idefine: has joined #ruby
[18:33:10] djbkd: has joined #ruby
[18:34:05] bronson: has joined #ruby
[18:34:09] edavis: has joined #ruby
[18:35:08] ramfjord: Why not just match the directory path with a regex like "\/Users\/([^\/]*)\/" instead of jumping up a bunch of paths?
[18:35:37] roshanavand: has joined #ruby
[18:35:51] shevy: I love you folks
[18:37:08] itguru: has joined #ruby
[18:40:25] drptbl: has joined #ruby
[18:40:26] ChiefAlexander: has joined #ruby
[18:41:19] jhass: Etc.getpwuid(File.stat(__FILE__).uid).name
[18:42:00] am55: has joined #ruby
[18:44:07] rbennacer: has joined #ruby
[18:46:28] ironcamel: i have a ruby script that sometimes hangs on a line that does something like x = `ssh host cmd ...`. what is the easiest way to do that operation with some sort of timeout, so it returns after a few seconds with a failure and doesn't hang?
[18:47:06] aegis3121: has joined #ruby
[18:48:05] jhass: probably better to use the net-ssh gem so you have more control
[18:48:13] jhass: should have timeout options too I'd hope
[18:48:17] jancel: has joined #ruby
[18:48:25] sthns: has joined #ruby
[18:48:40] ironcamel: installing gems in not currently an option :(
[18:49:32] ironcamel: should i fork a process?
[18:50:14] jhass: -o 'ConnectTimeout 5' perhaps?
[18:50:25] pawnbox: has joined #ruby
[18:50:36] am55: has joined #ruby
[18:50:37] ironcamel: hmmm, that might work
[18:51:27] cloaked1: has joined #ruby
[18:51:27] cloaked1: has joined #ruby
[18:54:50] pfoyh: has left #ruby: ()
[18:55:14] wrkrcoop: has joined #ruby
[18:55:23] darkxploit: has joined #ruby
[18:55:36] Kruppe: has joined #ruby
[18:57:16] jackjackdripper: has joined #ruby
[18:57:33] diego2: has joined #ruby
[18:57:40] diego2: has joined #ruby
[18:58:27] djbkd: has joined #ruby
[18:58:42] jackjackdripper: has joined #ruby
[18:59:18] djbkd: has joined #ruby
[19:00:46] davedev24: has joined #ruby
[19:02:36] wilbert: has joined #ruby
[19:04:01] dionysus69: has joined #ruby
[19:04:35] diego2: has joined #ruby
[19:05:37] davedev24: has joined #ruby
[19:07:35] tw1sted_: has joined #ruby
[19:09:06] iceden: has joined #ruby
[19:09:39] Don_John: has joined #ruby
[19:10:35] skade: has joined #ruby
[19:10:37] diego3: has joined #ruby
[19:10:41] solars: has joined #ruby
[19:10:45] diego3: has joined #ruby
[19:11:04] codecop: has joined #ruby
[19:14:06] rhastra: has joined #ruby
[19:14:43] skade: has joined #ruby
[19:16:25] rhastra: has joined #ruby
[19:18:23] zeroDi: has joined #ruby
[19:20:47] spider-mario: has joined #ruby
[19:22:16] ravishankarjha: has joined #ruby
[19:22:27] roamingdog: has joined #ruby
[19:23:05] TheCubeLord: welp i be off goodnight!
[19:25:25] tAn: has joined #ruby
[19:26:05] jackjackdripper1: has joined #ruby
[19:27:35] jackjackdripper: has joined #ruby
[19:30:37] xall: has joined #ruby
[19:31:45] skade: has joined #ruby
[19:34:58] stannard: has joined #ruby
[19:35:44] idefine_: has joined #ruby
[19:35:44] skade: has joined #ruby
[19:35:47] zyzioziom: has joined #ruby
[19:38:06] symm-: has joined #ruby
[19:38:06] karmatr0n: has joined #ruby
[19:38:25] stannard: has joined #ruby
[19:39:06] djbkd: has joined #ruby
[19:39:25] djbkd: has joined #ruby
[19:39:43] scooter_: has joined #ruby
[19:40:09] scooter_: Is this the appropriate channel for ruby on rails question?
[19:40:32] prestorium: has joined #ruby
[19:40:51] rhastra: there is a #rubyonrails channel
[19:41:03] scooter_: Okay thanks
[19:41:56] pawnbox: has joined #ruby
[19:43:05] drptbl: has joined #ruby
[19:43:08] halfamind: has joined #ruby
[19:43:43] oetjenj: has joined #ruby
[19:44:35] zacts: hi rubyists
[19:44:42] bronson: has joined #ruby
[19:46:29] shevy: yo zacts the ruby-learning man
[19:47:29] mistermocha: has joined #ruby
[19:49:04] zacts: yo shevy! :-)
[19:49:05] drptbl: has joined #ruby
[19:49:07] al2o3-cr: has joined #ruby
[19:49:34] zacts: I'm almost to ch 9 of this Head First Ruby book. I may even finish ch 10 this evening, which will put me 2/3 of the way thru
[19:49:46] zacts: I feel I'm learning tons
[19:53:04] giz|work|2: has joined #ruby
[19:53:40] whathappens: has joined #ruby
[19:53:58] daemonwrangler: Anyone familiar with rubocop? Confused by something it's flagging for Style/HashSyntax, but I think is just a keyword arg.
[19:54:32] jhass: say more?
[19:54:55] Es0teric: has joined #ruby
[19:55:11] daemonwrangler: https://www.irccloud.com/pastebin/EsTWx06h/
[19:55:12] ruby[bot]: daemonwrangler: we in #ruby do not like irccloud.com, I reposted your paste to gist for you: https://gist.github.com/c12d54dda699f1af61607939ddc094c8
[19:55:13] ruby[bot]: daemonwrangler: irccloud.com has no syntax highlighting, distracting formatting and loads slowly for most.
[19:55:49] yfeldblum: has joined #ruby
[19:57:20] roamingdog: has joined #ruby
[19:57:27] Zarthus: daemonwrangler: sounds like stuff => :stuff
[19:59:34] daemonwrangler: Yeah, that's what I was thinking, but wasn't expecting it to flag a method call with keyword args. For example, checker_func in remove(destination, checker_func: :directory?)
[20:00:36] diego2: has joined #ruby
[20:01:04] jhass: that's not the default setting anyway https://github.com/bbatsov/rubocop/blob/master/config/default.yml#L516-L523
[20:01:07] daemonwrangler: The rubocop config has TargetRubyVersion set to 2.0, so I would hope it'd recognize keyword arg syntax.
[20:01:18] riddley: has joined #ruby
[20:01:23] riddley: you have an array of DateTime objects. how do you group them by proximity within THRESHOLD ?
[20:01:56] jhass: riddley: where did you copy paste that assignment from and what did you try so far?
[20:03:12] daemonwrangler: jhass: It may be a better question for me to ask the jekyll devs since they explicitly set "EnforcedStyle: hash_rockets"
[20:03:44] diego2: has joined #ruby
[20:03:45] riddley: haha :) it's not an assignment. I'm looking at our snapshot schedules and trying to see when we have snapshots that "collide" (within a few minutes) I've gotten the date time objects created, but haven't been able to figure out what to do next. Enumerable#partition doesn't yield two arguments, so I can't compare proximity that way... seems like only #sort yields things, but sorting doesn't really help me
[20:03:50] drptbl: has joined #ruby
[20:03:59] bougyman: Array(some_hash) did not do what I expected.
[20:04:13] bougyman: usually Array(array_or_item) returns [array_or_item]
[20:04:27] jhass: daemonwrangler: https://github.com/bbatsov/rubocop/issues/1451 only thing I found on the issue tracker about it
[20:04:29] bougyman: in the hash's case, it returns [[key, val]]
[20:04:29] idefine: has joined #ruby
[20:04:30] dikaio: has joined #ruby
[20:04:37] bougyman: I hate it when ruby surprises me.
[20:04:40] adaedra: bougyman: Array() calls #to_a on the object.
[20:04:47] bougyman: adaedra: I see that now.
[20:05:05] bougyman: but string doesn't have a #to_a
[20:05:05] adaedra: Nothing surprising here.
[20:05:12] bougyman: and Array(string) does the right thing, too
[20:05:17] diego2: has joined #ruby
[20:05:23] aphprentice_: has joined #ruby
[20:05:24] bougyman: well, the "expected right" thing
[20:05:29] diego2: has joined #ruby
[20:05:34] adaedra: What is not expected in the above behavior?
[20:05:39] daemonwrangler: jhass: That seems prett definitive though. Thanks!
[20:05:52] daemonwrangler: s/prett/pretty/
[20:05:58] bougyman: I've always used Array(array_or_item) to coerce things to [array_or_item]
[20:06:05] bougyman: it's my habit that led to the surprise.
[20:06:22] adaedra: A hash is representable as a array of [key, value]s
[20:06:27] bougyman: I know that.
[20:06:31] Rutix: has joined #ruby
[20:06:32] Rutix: has joined #ruby
[20:06:34] hahuang65: has joined #ruby
[20:06:50] riddley: jhass, any thoughts?
[20:07:15] jhass: still thinking
[20:07:42] riddley: I guess I could use Enumerable#each_cons but I was hoping for something else
[20:07:42] bougyman: adaedra: https://gist.github.com/anonymous/c33979e31d1047066fff5c9842d1efbe
[20:08:02] bougyman: I guess what i'm asking is how do I get the behavior that i'm used to for strings, numbers, and symbols working in this case.
[20:08:20] adaedra: so you want `[{one: 1}]`?
[20:08:32] arpegius: has joined #ruby
[20:08:40] Nahra: has joined #ruby
[20:09:26] adaedra: (n.is_a?(Array) ? n : [n]) would be the one that does not expand objects implementing #to_ary/#to_a, I guess.
[20:09:26] rhastra: has joined #ruby
[20:09:27] jhass: riddley: I'd say figure out what Enumerable#group_by uses to determine "equalness" (probably Hash's key contract, #hash and #eql?) and write a wrapper that defines those such that two within the threshold are considered equal
[20:09:52] safetypin: has joined #ruby
[20:10:38] ghr: has joined #ruby
[20:11:04] riddley: jhass, group_by seems to be C, so I'm pretty lost
[20:11:19] bougyman: adaedra: yeah, that's pretty much what I ended up with.
[20:12:04] hobodave_: has joined #ruby
[20:12:05] jhass: riddley: it's pretty much .each_with_object({}) {|i, h| (h[yield i] ||= []) << i }
[20:12:53] riddley: jhass, that yield blows my tiny mind... what does that do?
[20:14:46] jhass: it yields?
[20:14:55] aegis3121: h is the {} passed in. `i` is your item. (yield i) returns the result of your block after passing i into it. ||= [] sets that value to a new array if there wasn't one there already. and the push operator is pushing that item into that array.
[20:15:33] djbkd: has joined #ruby
[20:15:48] riddley: oh, so you must pass a block to that?
[20:15:52] pfoyh: has joined #ruby
[20:15:58] riddley: ty aegis3121
[20:16:12] djbkd: has joined #ruby
[20:16:19] dima_: has joined #ruby
[20:17:20] DanyC: has joined #ruby
[20:17:29] roshanavand: has joined #ruby
[20:17:44] wrkrcoop: has joined #ruby
[20:17:51] Jackneill: has joined #ruby
[20:18:23] jhass: riddley: say we got [2016-01-01, 2016-01-03, 2016-01-04, 2016-01-06] and a treshold of 2 days, what's the result exactly you expect?
[20:18:30] riddley: I still don't get it.... if I'm only yielding one thing, how can I compare proximity?
[20:19:08] riddley: I'd expect [[2016-01-01, 2016-01-03, 2016-01-04,],[2016-01-06]]
[20:19:28] safetypin: has joined #ruby
[20:19:36] jhass: I don't follow
[20:19:54] jhass: 01 to 03 is two days, 04 to 06 is two days
[20:20:29] riddley: Sorry, I guess I'd expect the whole array
[20:20:41] dima_: has left #ruby: ()
[20:20:43] pfoyh: has left #ruby: ()
[20:20:51] mistermocha: has joined #ruby
[20:21:02] imperator: has left #ruby: ("Leaving")
[20:21:17] jhass: and then for [2016-01-06, 2016-01-03, 2016-01-01, 2016-01-04] still?
[20:21:45] riddley: that's just a re-order? if so, yes. I've sorted my array
[20:22:08] riddley: but if -06 was -07 it would be off by itself
[20:22:15] pfoyh: has joined #ruby
[20:22:16] dima_: has joined #ruby
[20:23:26] bobbycvi: has joined #ruby
[20:23:36] cdg: has joined #ruby
[20:26:50] chopin: has joined #ruby
[20:27:24] eljimmy: has joined #ruby
[20:27:32] mistermocha: has joined #ruby
[20:27:39] araujo: has joined #ruby
[20:27:52] karmatr0n: has joined #ruby
[20:27:56] jenrzzz: has joined #ruby
[20:27:56] jenrzzz: has joined #ruby
[20:29:38] idefine: has joined #ruby
[20:29:56] millerti: has joined #ruby
[20:30:08] idefine: has joined #ruby
[20:30:46] jhass: riddley: https://p.jhass.eu/1p.rb would be my first shot, not sure yet I prefer it over say implementing something more directly that doesn't require to fix to a single hash bucket
[20:30:50] DanyC: has joined #ruby
[20:30:51] arpegius: has joined #ruby
[20:31:26] riddley: jhass, reading. thank you!
[20:32:54] SilverKey: has joined #ruby
[20:34:53] pietr0: has joined #ruby
[20:35:12] tAn: has joined #ruby
[20:35:29] riddley: jhass, I don't understand that at all :( reading about simpledelegator
[20:36:15] riddley: jhass, thank you very much for helping me with this
[20:36:20] blackmes1: has joined #ruby
[20:37:05] jancel: has joined #ruby
[20:38:18] charliesome: has joined #ruby
[20:38:39] jhass: mmmh, given we're operating on a sorted array, slice_before or the like should work too
[20:39:40] riddley: jhass, so group_by is being sneaky and passing in two values to the block even though it only has |date| ? which is why your .eql delegator can do the subtraction and compare it to the threshold. I assume PW#hash is some internal thing and that the call to super is about making SimpleDelegator happy?
[20:39:42] s2013: has joined #ruby
[20:39:51] jgt1: has joined #ruby
[20:40:14] bruce_lee: has joined #ruby
[20:40:15] bruce_lee: has joined #ruby
[20:40:35] Coldblackice: has joined #ruby
[20:40:40] allcentury: has joined #ruby
[20:40:44] jhass: yes to the last one. group_by is using a hash (see the ruby version I wrote above). read the docs for Hash (at the top) for an explanation on how #hash and #eql? come into play
[20:41:00] chouhoulis: has joined #ruby
[20:43:12] jhass: anyway, disregard it, it's incorrect
[20:43:38] chipotle: has joined #ruby
[20:45:46] jhass: .sort.slice_when {|a, b| (a-b).abs > THRESHOLD }.to_a is the correct solution
[20:46:16] jhass: https://p.jhass.eu/1q.rb here's another one for fun
[20:46:35] gizmore: has joined #ruby
[20:48:29] dvinciguerra: has joined #ruby
[20:48:35] riddley: yea the double loop... isn't there some weird behavior when you use break in a block?
[20:48:39] marr: has joined #ruby
[20:49:15] SilverKey: has joined #ruby
[20:49:26] jhass: break returns from the method invoking the block, the argument to break becomes the methods return value. next returns from the block, the argument becomes the blocks return value
[20:51:21] pawnbox: has joined #ruby
[20:51:37] riddley: jhass, thanks again. This one is closer to my level of understanding. I'll continue to study it.
[20:52:05] jhass: riddley: keep in mind that I consider .slice_when the correct one by now
[20:52:19] jhass: so take that more as a fun exercise
[20:53:03] charliesome: has joined #ruby
[20:54:05] KINGSABRI: has joined #ruby
[20:54:45] riddley: jhass, haha the best part is that I'm using (and must keep using) Ruby 2.1 which has no slice_when
[20:55:39] KINGSABRI: Hello guys ,, is there anyway to add hex values and check if there Carry out?
[20:55:42] roamingdog: has joined #ruby
[20:57:39] jhass: KINGSABRI: could you clarify? show what you've tried so far? example input/desired output?
[21:00:26] KINGSABRI: jhass https://repl.it/CQdR/1
[21:01:43] KINGSABRI: I want to make sum calcualtion and I need a way/method to tell if there is a carry out of the result
[21:01:49] A124: has joined #ruby
[21:02:08] johnmilton: has joined #ruby
[21:02:38] adaedra: You always have numbers in the [0x0,0x10000[ range?
[21:02:53] Gasher: has joined #ruby
[21:03:14] KINGSABRI: I didn't understand your question , if you're asking me :)
[21:03:56] adaedra: Are you numbers always between 0x0 and 0xffff?
[21:04:54] blackmesa: has joined #ruby
[21:05:04] KINGSABRI: the real case is ,, the numbers are 4 bytes but I have to devide it to 2 bytes for each value
[21:05:05] JoshGlzBrk: has joined #ruby
[21:05:22] mistermocha: has joined #ruby
[21:05:40] KINGSABRI: I'm working with permutations and find the sum of 3 values that equals a values
[21:05:59] adaedra: so you want to be sure your number is always < 0x10000 then
[21:07:08] djbkd: has joined #ruby
[21:08:48] jhass: .clamp(0..0xffff) ... right this ain't crystal :P
[21:08:50] KINGSABRI: the case is like that I've a values let's say: 0xabcdabcd, I've 121 hex bytes that I've to find a some of 3 characters equals 0xabcdabcd
[21:08:57] AnoHito: has joined #ruby
[21:09:13] adaedra: But, for the fun, here's to check if you ever have a number of digits bigger than any of the components of your sum: https://eval.in/571298
[21:09:43] adaedra: jhass: shhh.
[21:09:51] KINGSABRI: so the 121 are the only allows value to play with in order to find the sum of the 3 values that = 0xabcdabcd
[21:10:03] adaedra: KINGSABRI: you know that 0x10 and 16 are exactly the same in the eye of Ruby?
[21:10:25] adaedra: there's no really "Hex bytes"
[21:10:26] jhass: adaedra: no need for the & there btw
[21:10:40] adaedra: jhass: yeah, I know, I like to have it :|
[21:10:50] KINGSABRI: adaedra , yes I know
[21:10:52] jhass: isn't it slower?
[21:12:12] adaedra: also, I think 0xffff is representable in only two bytes
[21:12:29] whathappens: has joined #ruby
[21:12:44] adaedra: I still don't understand what KINGSABRI is trying to do
[21:14:18] stannard: has joined #ruby
[21:14:21] adaedra: jhass: for performance, I actually wonder on the viability of my solution, between Math.log and Numeric#to_s + String#length.
[21:14:31] sesquipedalian: has joined #ruby
[21:14:37] sp4rrow: has joined #ruby
[21:15:22] KINGSABRI: ok , I've this value: 0x33c05068 I need the sum of 3 hex values that equals 0x33c05068
[21:15:32] jhass: I'd expect it be faster until Bignum comes into play
[21:15:51] adaedra: KINGSABRI: 0x33c05065, 0x1, 0x2?
[21:15:58] jhass: math ought to be faster than string allocation
[21:16:37] KINGSABRI: but if you have 121 hex bytes to find the right values
[21:17:28] KINGSABRI: so you guys think it's better to work on it as decemial not hex values ?
[21:17:33] joneshf-laptop: has joined #ruby
[21:17:38] adaedra: 3 * 0xff is way below 0x33c05068
[21:17:46] adaedra: hex or decimal is the exact same
[21:17:57] adaedra: it's just the representation to your human eyes
[21:18:08] eam: KINGSABRI: they're all binary
[21:18:15] eam: computers don't use base 10 or base 16
[21:18:18] dfockler: has joined #ruby
[21:18:38] eam: only base 2
[21:19:03] adaedra: base 16 representation may be a bit easier for your eyes tho, as the limit between bytes is easy to see (every 2 digits)
[21:19:07] halfamind1: has joined #ruby
[21:19:15] KINGSABRI: ok now I have to split each value into 2 parts: 0x33c0 0x5068
[21:19:33] halfamind: has joined #ruby
[21:19:43] KINGSABRI: and try to find 3 values = 0x33c0 thne 3 values = 0x5068
[21:20:11] zyzioziom: has joined #ruby
[21:20:14] KINGSABRI: this works for me some values ,, but it gives me wrong values for others
[21:20:36] djbkd: has joined #ruby
[21:20:41] adaedra: >> v = 0x33c05068; [v & 0xffff, v & 0xffff0000 >> 16]
[21:20:43] ruby[bot]: adaedra: # => [20584, 20584] (https://eval.in/571301)
[21:20:59] adaedra: erf, beaten by priority of operators.
[21:21:14] djbkd: has joined #ruby
[21:21:34] adaedra: >> v = 0x33c05068; [v & 0xffff, (v & 0xffff0000) >> 16].map { |e| e.to_s 16 }
[21:21:35] ruby[bot]: adaedra: # => ["5068", "33c0"] (https://eval.in/571303)
[21:22:32] stannard: has joined #ruby
[21:22:52] adaedra: I'm not aware of an easier way of splitting by 2-bytes words in Ruby, I usually don't go this low
[21:23:34] jhass: could probably .pack & .unpack but ain't really getting prettier
[21:23:43] adaedra: Ah, I forgot those
[21:23:51] KINGSABRI: I didn't understand what the code want to do exactly :(
[21:24:20] adaedra: You're not familiar with binary masks and bit shifting?
[21:25:03] johnmilton: has joined #ruby
[21:25:18] jhass: >> [0x33c05068].pack("L").unpack("S*").map {|n| n.to_s(16) }
[21:25:19] ruby[bot]: jhass: # => ["5068", "33c0"] (https://eval.in/571305)
[21:25:32] halfamind: has joined #ruby
[21:26:38] KINGSABRI: I'm trying to be familier becuse I'm doing it the hard way
[21:26:57] adaedra: N and n* would give the array in the wanted order, though.
[21:27:24] allcentu1: has joined #ruby
[21:27:34] adaedra: Even if I'm not sure we're really clear on what we want here.
[21:28:16] jhass: I'm amazed at how you understand anything for 20 minutes already
[21:29:07] shevy: he has a MEGA brain
[21:29:19] adaedra: No, FBI closed MEGAbrain too.
[21:30:09] adaedra: I'm still not sure I'm holding the rope from the right end still.
[21:30:56] halfamind1: has joined #ruby
[21:33:02] shevy: just make it a circle!
[21:34:17] jhass: yeah I'm still 50/50 between "split visually" (0xabcdef -> 0xab, 0xcd, 0xef) and split "mathematically" ( n / 3 + padding)
[21:34:47] eljimador: has joined #ruby
[21:35:16] adaedra: well, I read about bytes, so I'd expect to be a byte split, here in network order/big endian
[21:35:18] jhass: iirc the latter was an assignment somewhere, not sure how the hex stuff comes into play then though
[21:35:55] adaedra: KINGSABRI: if it's an assignment, is there the subject somewhere?
[21:35:56] jhass: KINGSABRI: maybe elaborate a bit on what's this for
[21:36:01] mtkd: has joined #ruby
[21:36:30] adaedra: there seems to be quite a misunderstanding on some concepts or the subject
[21:36:35] KINGSABRI: ok here is my script https://gist.github.com/KINGSABRI/d0baf2ba3e36657c740f3c141602ffd8
[21:37:02] austinprog: has joined #ruby
[21:37:05] adaedra: CHARS = (0x0..0x7f).map(&:to_s)
[21:37:23] adaedra: CHARS = (0x0..0x7f).map { |e| e.to_s 16 }
[21:37:27] charliesome: has joined #ruby
[21:38:03] austinprog: Hey everyone. What is the method to get a number as a double? I know gets.chomp().to_i gets integer but not specifically working for something like 8.0
[21:38:13] KINGSABRI: if I permutations is 4 element it will take forever
[21:38:38] replay: has joined #ruby
[21:39:27] shevy: austinprog just float, .to_f should work
[21:39:30] platzhirsch: has joined #ruby
[21:39:42] austinprog: Thank you! I will try that
[21:40:55] adaedra: All of this seems pretty confused
[21:41:51] KINGSABRI: adaedra , jhass as you can see from script
[21:42:20] KINGSABRI: there is a small processing but on huge number of permutations .. the main issue is the carry out
[21:42:28] adaedra: I read badly from source code actually, especially at 23:40, don't you have a clearer explanation of what is needed?
[21:43:37] yqt: has joined #ruby
[21:43:52] KINGSABRI: it's an encoder for hex values
[21:48:23] pawnbox: has joined #ruby
[21:50:12] apeiros: it taketh the input and encodeth it in hex
[21:50:35] loincloth: has joined #ruby
[21:51:46] apeiros: austinprog: Float(string) might be better than .to_f, since it'll raise if the value is not a valid float representation
[21:51:51] apeiros: >> "hello world".to_f
[21:51:52] ruby[bot]: apeiros: # => 0.0 (https://eval.in/571307)
[21:51:58] apeiros: >> Float("hello world")
[21:51:59] ruby[bot]: apeiros: # => invalid value for Float(): "hello world" (ArgumentError) ...check link for more (https://eval.in/571308)
[21:52:21] adaedra: I see an error in both. "0.0" => what the f did you gave to me smiley.
[21:53:14] diego1: has joined #ruby
[21:56:12] allcentury: has joined #ruby
[21:57:05] JoshGlzBrk: has joined #ruby
[21:57:43] workmad3: has joined #ruby
[21:58:57] symm-: has joined #ruby
[21:59:00] shevy: are you people doing again animated ascii there
[21:59:03] jhass: KINGSABRI: how about picking random values between 0 and n/2 for the first and second value, and n-v1-v2 for the third?
[22:00:00] adaedra: shevy: let's first implement correctly APNG before doing AASCII.
[22:00:17] adaedra: Woohoo, message at 00:00:00.
[22:00:24] KINGSABRI: jhass mmm I'll try this idea , It might save time
[22:01:50] jhass: KINGSABRI: or to have a wider spectrum, rand(n) for the first and rand(n-v1) for the second
[22:02:08] jhass: and shuffle the result
[22:02:54] mistermocha: has joined #ruby
[22:06:55] Devalo: has joined #ruby
[22:10:02] dvinciguerra: has joined #ruby
[22:10:43] mistermocha: has joined #ruby
[22:10:46] arpegius: has joined #ruby
[22:10:54] flashpoint9: has joined #ruby
[22:11:55] djbkd: has joined #ruby
[22:12:15] leitz: has joined #ruby
[22:12:59] leitz: Bummer of the day; reading messy old code and knowing that it's my messy old code....
[22:13:22] Coldblackice: has joined #ruby
[22:13:34] apeiros: "omg, it's so bad! who wrote that, when, and why?" - "oh, I wrote it. yesterday."
[22:13:56] leitz: Hey apeiros, good to see you again.
[22:14:51] leitz: I'm trying to see if I want to just start over with the project, after I spend a few more weeks relearning the basics.
[22:14:55] adaedra: git blame yourself
[22:15:07] djbkd: has joined #ruby
[22:15:17] Masonn: has joined #ruby
[22:16:29] shevy: leitz yeah, sometimes it is not lack of knowledge though but syntax changes; such as the new hash syntax, I found it to be good for like single-key hashes Ponicorn.new(colour: :pink)
[22:16:32] sinkensabe: has joined #ruby
[22:16:58] shevy: more annoying is old code that I have that was written by someone else while being very complicated
[22:17:04] Guest38: has joined #ruby
[22:17:28] leitz: shevy, yeah, well. You know me, still the old Ruby version. The issue is that I'm an OOP newb and the classes are probalby poorly laid out.
[22:17:51] leitz: Like, "where is that variable set?" sort of poorly laid out.
[22:18:01] shevy: you are stuck with some older ruby version too?
[22:18:24] leitz: Yup. I mostly do server work and have to use what's on the server.
[22:18:27] shevy: I guess my own code would look very different if I have to remain compatible to 1.8.x now
[22:18:30] riobe: has joined #ruby
[22:18:56] adaedra: can we keep 1.8 in the past where it belongs?
[22:19:34] apeiros: keeping your code 1.8 compatible is like trying to keep your car horse compatible
[22:19:44] leitz: Sadly, no adaedra.
[22:19:58] leitz: Not for another couple years.
[22:20:39] shevy: you can eat horses!
[22:20:47] oetjenj: has joined #ruby
[22:21:35] halfamind: has joined #ruby
[22:21:43] Biopandemic: has joined #ruby
[22:22:08] adaedra: apeiros: speaking of which, I think I have a problem with my car. I feed it hay but it refuses to eat it. What should I do?
[22:22:37] leitz: I think this job will require ice cream. I need to map out how the thing works again.
[22:22:51] leitz: Back in a bit.
[22:22:57] SCHAAP137: has joined #ruby
[22:23:56] apeiros: adaedra: you should ask a veterinarian
[22:24:10] apeiros: maybe your car is sick
[22:24:43] adaedra: my car really is sick.
[22:25:47] adaedra: Welp, time for me to go to 3053.
[22:26:23] tatsuo: has joined #ruby
[22:30:05] duoi: has joined #ruby
[22:30:09] djbkd: has joined #ruby
[22:31:09] duoi: has joined #ruby
[22:35:02] jenrzzz_: has joined #ruby
[22:36:08] zenlot6: has joined #ruby
[22:38:47] tatsuo: can I get a upload progress in http post upload for restclient?
[22:40:51] tatsuo: has joined #ruby
[22:41:20] sinkensabe: has joined #ruby
[22:41:31] troulouliou_div2: has joined #ruby
[22:44:13] djbkd: has joined #ruby
[22:46:06] roamingdog: has joined #ruby
[22:46:31] leitz: ACTION returns with milk and cookies.
[22:49:51] gizless: has joined #ruby
[22:50:04] casp: has joined #ruby
[22:50:10] mistermocha: has joined #ruby
[22:50:37] nando293921: has joined #ruby
[22:50:47] gizless: has joined #ruby
[22:51:18] casp: has left #ruby: ()
[22:51:34] mistermocha: has joined #ruby
[22:53:05] moeabdol: has joined #ruby
[22:53:05] chipotle: has joined #ruby
[22:53:12] Azure|dc: has joined #ruby
[22:55:49] ramfjord_: has joined #ruby
[22:55:52] arescorpio: has joined #ruby
[22:56:26] stannard: has joined #ruby
[22:59:10] ReK2: has joined #ruby
[22:59:10] ReK2: has joined #ruby
[22:59:26] SilverKey: has joined #ruby
[23:00:29] tildes: has joined #ruby
[23:02:39] pawnbox: has joined #ruby
[23:06:37] casp: has joined #ruby
[23:12:26] mistermocha: has joined #ruby
[23:14:40] joaumg: has joined #ruby
[23:15:37] riobe: has joined #ruby
[23:16:53] chouhoulis: has joined #ruby
[23:16:58] Kitt3n: has joined #ruby
[23:18:45] ramfjord: has joined #ruby
[23:19:20] xall: has joined #ruby
[23:19:46] Kitt3n: has joined #ruby
[23:20:01] jancel: has joined #ruby
[23:20:12] idefine: has joined #ruby
[23:24:54] jwren: has joined #ruby
[23:26:45] leitz: Okay, an actual Ruby question. Not about horses.
[23:27:03] leitz: In the initialize section of a class, there's a line: @terms = char['terms'] || terms
[23:27:49] leitz: The ending "terms" is a method that will set @terms to something. It is called if char['terms'] isn't passed as a part of the initialize.
[23:28:38] leitz: Am I right in thinking that if an object like this is created, it has a terms vaule that can get changed if the object's "terms" method is called?
[23:29:25] leitz: So terms is set, and then reset.
[23:29:30] AndroidLoverInSF: has joined #ruby
[23:29:48] djbkd: has joined #ruby
[23:29:51] smathy: leitz, only if the `terms` method sets `@terms` as a side-effect.
[23:33:41] leitz: smathy, not sure if "side effect' has a special meaning. The terms method sets the terms number and derives age from the number of terms.
[23:33:56] leitz: So yes, calling terms sets terms.
[23:34:12] leitz: Hmm... @terms ||= Traveller.roll_dice(6,1,1)
[23:34:29] leitz: That's from the body of the method. So it might only reset it if not set.
[23:37:12] ramfjord: has joined #ruby
[23:38:43] smathy: leitz, yes, that's correct. It will only set it if it's falsey.
[23:39:07] smathy: (and yes, that's a side effect, although a fairly common one called memoization)
[23:39:29] Vile`: has joined #ruby
[23:40:35] gizmore: has joined #ruby
[23:41:30] dvinciguerra: has joined #ruby
[23:41:35] juanfra: has joined #ruby
[23:43:40] kareeole_: has joined #ruby
[23:46:08] bronson: has joined #ruby
[23:47:50] rrichardsr3: has joined #ruby
[23:52:22] djbkd: has joined #ruby
[23:52:47] jtd: has joined #ruby
[23:54:02] idefine: has joined #ruby
[23:54:12] mjs2600: has joined #ruby
[23:55:40] ule: has joined #ruby
[23:56:18] d0nn1e: has joined #ruby
[23:56:53] jgt1: has joined #ruby
[23:58:29] mlehrer: has joined #ruby