« Back to channel list

#ruby - 20 June 2016

« Back 1 day Forward 1 day »
[00:04:25] dcunit3d: has joined #ruby
[00:07:47] wixad_: hi all im trying to implement OptionParser to ruby quiz when i call the script it just returns the passed in argument instend of changing the size of the digits here is the code
[00:08:00] wixad_: https://gist.github.com/codias/3c2ef7fa0fbf5a08b808c913be56e8b8
[00:09:39] armyriad: has joined #ruby
[00:10:18] karmatr0n: has joined #ruby
[00:12:31] rickmasta: has joined #ruby
[00:14:04] xall: has joined #ruby
[00:15:49] laska: has joined #ruby
[00:21:23] MrBusiness: has joined #ruby
[00:22:00] djbkd: has joined #ruby
[00:24:11] mattwashere: has joined #ruby
[00:27:37] hutch34: has joined #ruby
[00:28:35] Yzguy: has joined #ruby
[00:30:23] astrobunny: has joined #ruby
[00:30:48] minimalism: has joined #ruby
[00:36:32] jhack: has joined #ruby
[00:37:45] hutch34: has joined #ruby
[00:38:52] nettoweb: has joined #ruby
[00:39:01] sdothum: has joined #ruby
[00:39:18] agentmeerkat: has joined #ruby
[00:40:01] Pwnna: has left #ruby: ("Leaving")
[00:41:48] evansbee: has joined #ruby
[00:42:37] nankyokusei: has joined #ruby
[00:44:21] creat: has joined #ruby
[00:46:34] hahuang62: has joined #ruby
[00:47:23] Ropeney: has joined #ruby
[00:51:13] Rodya_: has joined #ruby
[00:52:00] giz|work: has joined #ruby
[00:52:06] hutch34: has joined #ruby
[00:54:31] jhack: has joined #ruby
[00:56:54] tomchapin: has joined #ruby
[00:57:51] Azure: has joined #ruby
[01:00:01] CloCkWeRX: has joined #ruby
[01:01:27] smathy: has joined #ruby
[01:01:55] ur5us: has joined #ruby
[01:02:05] ur5us: has joined #ruby
[01:02:20] hutch34: has joined #ruby
[01:04:01] yfeldblum: has joined #ruby
[01:07:37] AcidCras_: has joined #ruby
[01:08:35] snsei: has joined #ruby
[01:11:15] karmatr0n: has joined #ruby
[01:14:43] xall: has joined #ruby
[01:16:23] djbkd: has joined #ruby
[01:17:10] djbkd: has joined #ruby
[01:17:57] djbkd: has joined #ruby
[01:18:42] djbkd: has joined #ruby
[01:19:35] djbkd: has joined #ruby
[01:23:54] LoneHermit: has joined #ruby
[01:34:45] blackmesa: has joined #ruby
[01:37:31] djbkd: has joined #ruby
[01:43:03] Yiota: has joined #ruby
[01:45:40] Bugboy1028: has joined #ruby
[01:46:03] flashpoint9: has joined #ruby
[01:48:21] djbkd: has joined #ruby
[01:49:57] `tim`: has joined #ruby
[01:50:04] jhack: has joined #ruby
[01:50:40] Sembei: has joined #ruby
[01:51:02] Bugboy1028: has joined #ruby
[01:51:04] torandu: has joined #ruby
[01:53:38] mattwashere: has joined #ruby
[01:53:58] shevy: wheee I never knew that they would use ruby https://github.com/freebsd/portupgrade
[01:54:53] shevy: and old ruby code style :P https://github.com/freebsd/portupgrade/blob/master/lib/pkgtools/pkginfo.rb#L170
[01:55:34] hutch34: has joined #ruby
[01:56:00] confounds: has joined #ruby
[01:57:12] confounds: has left #ruby: ()
[01:58:41] jhack: has joined #ruby
[01:59:56] gfvcastro: has joined #ruby
[02:01:09] pawnbox: has joined #ruby
[02:07:29] mshowman: has joined #ruby
[02:07:51] Axy: has joined #ruby
[02:08:54] astrobunny: has joined #ruby
[02:12:20] karmatr0n: has joined #ruby
[02:13:34] szu: has joined #ruby
[02:14:28] hutch34: has joined #ruby
[02:16:54] pilne: has joined #ruby
[02:17:00] xall: has joined #ruby
[02:19:12] jhack: has joined #ruby
[02:25:15] eljimmy: has joined #ruby
[02:26:29] rickmasta: has joined #ruby
[02:27:45] dcunit3d: has joined #ruby
[02:28:45] pawnbox: has joined #ruby
[02:29:30] rickmasta: has joined #ruby
[02:31:03] jancel: has joined #ruby
[02:32:33] jhack: has joined #ruby
[02:34:04] karmatr0n: has joined #ruby
[02:34:46] nchambers: has joined #ruby
[02:38:10] blackmesa: has joined #ruby
[02:38:40] braincrash: has joined #ruby
[02:39:38] rickmasta: has joined #ruby
[02:41:11] robot: has joined #ruby
[02:41:13] sauvin: has joined #ruby
[02:41:15] yardenbar: has joined #ruby
[02:41:40] agentmeerkat: has joined #ruby
[02:41:47] giz|work: has joined #ruby
[02:42:24] maloik: has joined #ruby
[02:43:26] nankyokusei: has joined #ruby
[02:47:30] jhack: has joined #ruby
[02:47:46] ornerymoose: has joined #ruby
[02:51:15] _gautam_: has joined #ruby
[02:58:52] jhack: has joined #ruby
[03:02:16] rickmasta: has joined #ruby
[03:06:58] someish: has joined #ruby
[03:07:24] djbkd: has joined #ruby
[03:07:37] i8igmac: im getting a file read error 'invalid byte sequence in UTF-8"
[03:07:43] i8igmac: string.split <---
[03:08:32] CloCkWeRX: has joined #ruby
[03:08:48] toretore: ?code i8igmac
[03:08:48] ruby[bot]: i8igmac: We can't help you without your code, please post it to https://gist.github.com
[03:09:49] i8igmac: http://pastebin.com/kixraxMS
[03:09:50] ruby[bot]: i8igmac: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/7c242b0a468f1875ca942eb6ee1da7a8
[03:09:52] ruby[bot]: i8igmac: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[03:09:54] evansbee: has joined #ruby
[03:10:56] i8igmac: https://gist.github.com/anonymous/4f803c0e6c1a021cd3ed91beb19d08e9
[03:11:04] pawnbox: has joined #ruby
[03:11:08] Kero: has joined #ruby
[03:12:17] toretore: gist the stacktrace too
[03:13:03] i8igmac: https://gist.github.com/anonymous/a13008c6742fa0e4f246542b2b9d82e5
[03:14:20] toretore: which encoding is `data` in?
[03:15:07] i8igmac: its binary data
[03:15:12] LoneHerm_: has joined #ruby
[03:15:18] i8igmac: could be a image or mp3 file
[03:15:33] toretore: what does `data.encoding` return?
[03:15:55] i8igmac: #<Encoding:UTF-8>
[03:16:46] toretore: you have to tell File that it's binary data when you read it
[03:17:10] giz|work: has joined #ruby
[03:17:48] xall: has joined #ruby
[03:18:08] toretore: http://www.rubydoc.info/stdlib/core/IO#initialize-instance_method
[03:21:17] k3rn31: has joined #ruby
[03:21:56] i8igmac: i have tried binread instead but still the same thing
[03:22:17] i8igmac: years ago i had to do something like this
[03:22:17] i8igmac: string.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
[03:22:21] i8igmac: but i cant remeber
[03:22:23] braincrash: has joined #ruby
[03:22:35] arescorpio: has joined #ruby
[03:24:12] shevy: if it is binary data, using binread. You can try the encoding ASCII-8BIT too
[03:26:35] shevy: wheee they are working on ruby 2.4.0 \o/ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L42
[03:26:53] LoneHerm_: has joined #ruby
[03:27:27] charliesome: has joined #ruby
[03:28:47] hutch34: has joined #ruby
[03:29:56] shevy: https://rubygems.org/stats interesting that mime-types is one of the top ten most downloaded gems ... is it pulled in via some other dep dependency perhaps?
[03:30:45] terminalrecluse: has joined #ruby
[03:33:12] Radar: shevy: It's a Rails dependency.
[03:35:03] karmatr0n: has joined #ruby
[03:35:36] gix: has joined #ruby
[03:38:07] edwardly: has joined #ruby
[03:38:07] edwardly: has joined #ruby
[03:40:40] jancel: has joined #ruby
[03:40:42] blackmesa: has joined #ruby
[03:43:09] pwnd_nsfw: has joined #ruby
[03:43:30] hutch34: has joined #ruby
[03:44:47] kareeoleez: has joined #ruby
[03:44:58] hk238: has joined #ruby
[03:52:22] Radar: through actionpack I think
[03:59:28] pawnbox: has joined #ruby
[03:59:35] mattwashere: has joined #ruby
[04:06:59] k3rn31: has joined #ruby
[04:08:06] charliesome: has joined #ruby
[04:13:16] voodoofish430: has joined #ruby
[04:15:01] Rinzlit: has joined #ruby
[04:16:08] rkazak: has joined #ruby
[04:18:06] pawnbox: has joined #ruby
[04:19:04] xall: has joined #ruby
[04:25:27] pawnbox: has joined #ruby
[04:25:32] charliesome: has joined #ruby
[04:31:37] banister: has joined #ruby
[04:35:55] karmatr0n: has joined #ruby
[04:36:20] hahuang62: has joined #ruby
[04:39:45] gfvcastro: has joined #ruby
[04:41:40] blackmesa: has joined #ruby
[04:44:21] nankyokusei: has joined #ruby
[04:44:59] amincd: has joined #ruby
[04:45:30] amincd: Hi, can anyone recommend any documentation for #to_io ? I have no idea how it works and nothing I've found online has helped me understand it
[04:45:51] Radar: ?ri to_io
[04:45:51] ruby[bot]: Radar: I don't see no to_io, whom should I tell about ri?
[04:45:57] Radar: @ruby[bot]: WRONG
[04:46:20] amincd: http://ruby-doc.org/core-1.9.3/IO.html#method-i-to_io
[04:46:33] amincd: http://ruby-doc.org/core-2.2.2/IO.html#method-i-to_io
[04:46:39] Radar: Well isn't that handy.
[04:47:23] Radar: amincd: It appears that it simply returns itself.
[04:47:31] Radar: amincd: Similar to how to_s on a string will return the string.
[04:47:32] amincd: Radar: what is the point of that?
[04:47:38] Radar: >> "abcd".to-s
[04:47:39] ruby[bot]: Radar: # => undefined method `to' for "abcd":String (NoMethodError) ...check link for more (https://eval.in/591864)
[04:47:40] Radar: >> "abcd".to_s
[04:47:41] ruby[bot]: Radar: # => "abcd" (https://eval.in/591865)
[04:48:07] Radar: My guess is that it's implemented in case you have some other object you want to convert to an IO.
[04:48:15] Radar: and you're not sure if that object is already an IO object or if it's that other kind of object.
[04:48:27] amincd: so it would test if it's an IO?
[04:48:45] amincd: I mean, that would be the purpose of the method, to test?
[04:49:11] Radar: Not to test. The method will convert return an IO object which corresponds to the initial object.
[04:49:44] amincd: but if it's returning the same object, how is that a 'conversion'
[04:49:55] pawnbox: has joined #ruby
[04:49:56] Radar: In the case of `to_io`, it will return the same object
[04:50:03] Radar: Sorry, that's `IO#to_io`
[04:50:03] bluOxigen: has joined #ruby
[04:50:16] Radar: http://ruby-doc.org/core-2.3.1/String.html#method-i-to_s
[04:50:17] Radar: Same as this method
[04:50:49] lightt: has joined #ruby
[04:50:49] amincd: yea, I see how it works now (I think). I just don't understand in what contexts it would be useful
[04:50:56] giz|work: has joined #ruby
[04:50:59] Radar: [14:48:07] <Radar> My guess is that it's implemented in case you have some other object you want to convert to an IO.
[04:51:04] Radar: [14:48:15] <Radar> and you're not sure if that object is already an IO object or if it's that other kind of object.
[04:51:10] d0nn1e: has joined #ruby
[04:51:19] amincd: but does this method convert non-IO objects into IO objects?
[04:51:25] conta: has joined #ruby
[04:51:36] Radar: this method only exists on objects of the IO class.
[04:52:03] pontiki: has joined #ruby
[04:52:39] amincd: correct me if I'm wrong, but does this " you're not sure if that object is already an IO object or if it's that other kind of object." mean "use IO#to_io to test if the object is an IO object"?
[04:53:12] Radar: I am confused by your use of "test"
[04:53:28] Radar: test to me would mean that it would return true/false depending on if the object is an IO or not
[04:53:40] amincd: true it's not a classical test
[04:53:50] pontiki: more like "ensure"
[04:53:52] laska: has joined #ruby
[04:53:57] amincd: pontiki: there that's the word
[04:54:05] harfangk: has joined #ruby
[04:54:11] SilverKey: has joined #ruby
[04:54:22] amincd: ok it's clear to me now, thanks a lot
[04:54:54] pontiki: note that i was remarking on grammar, not accuracy of Ruby methods
[04:56:07] amincd: I'm just going to assume this is what the method does
[04:56:33] Radar: Yes, its likely intended design is to ensure you always end up with an IO object.
[05:00:10] laska: has joined #ruby
[05:02:42] webus: has joined #ruby
[05:04:06] ngw: has joined #ruby
[05:06:02] LoneHerm_: has joined #ruby
[05:10:45] evansbee: has joined #ruby
[05:10:51] howdoi: has joined #ruby
[05:16:49] binaryplease1: has joined #ruby
[05:19:57] xall: has joined #ruby
[05:20:14] dionysus69: has joined #ruby
[05:20:44] certainty: has joined #ruby
[05:22:41] craigp: has joined #ruby
[05:29:28] jancel: has joined #ruby
[05:30:05] pawnbox: has joined #ruby
[05:30:06] Dimik: has joined #ruby
[05:30:31] jpterry: has joined #ruby
[05:30:41] giz|work: has joined #ruby
[05:32:03] northfurr: has joined #ruby
[05:33:49] ur5us: has joined #ruby
[05:35:49] certainty: has joined #ruby
[05:36:48] karmatr0n: has joined #ruby
[05:37:11] Sammichmaker: has joined #ruby
[05:38:23] hahuang62: has joined #ruby
[05:38:44] pawnbox: has joined #ruby
[05:42:30] blackmesa: has joined #ruby
[05:43:46] hutch34: has joined #ruby
[05:45:36] LoneHerm_: has joined #ruby
[05:47:07] mercerist: has joined #ruby
[05:49:45] last_staff: has joined #ruby
[05:54:24] abprime: has joined #ruby
[05:55:07] apofis: has joined #ruby
[05:55:13] yardenbar: has joined #ruby
[05:55:23] n1x-nz: has joined #ruby
[05:56:16] d0lph1n98: has joined #ruby
[05:57:39] kareeoleez: has joined #ruby
[05:59:59] certainty: has joined #ruby
[06:02:05] charliesome: has joined #ruby
[06:02:40] Yiota: has joined #ruby
[06:02:59] duncannz: has joined #ruby
[06:03:06] jas02: has joined #ruby
[06:03:09] tcopeland1: has joined #ruby
[06:06:56] DTZUBDUB: has joined #ruby
[06:12:56] lightt: has joined #ruby
[06:12:58] vuoto: has joined #ruby
[06:14:22] the_drow: has joined #ruby
[06:15:03] Nawn: has joined #ruby
[06:18:39] blaxter: has joined #ruby
[06:21:03] xall: has joined #ruby
[06:22:59] firstdayonthejob: has joined #ruby
[06:24:08] zacstewart: has joined #ruby
[06:24:31] fenre: has joined #ruby
[06:27:28] last_staff: has joined #ruby
[06:27:50] norc: has joined #ruby
[06:30:32] aganov: has joined #ruby
[06:32:46] jxs__: has joined #ruby
[06:33:11] flughafen_: has joined #ruby
[06:34:50] DTZUBDUB: has joined #ruby
[06:34:54] dh64: has joined #ruby
[06:35:56] tildes: has joined #ruby
[06:37:42] karmatr0n: has joined #ruby
[06:38:32] conta: has joined #ruby
[06:38:51] Ishido: has joined #ruby
[06:39:02] bluOxigen: has joined #ruby
[06:39:21] bigkevmcd: has joined #ruby
[06:39:24] xall: has joined #ruby
[06:42:47] agentmeerkat: has joined #ruby
[06:42:53] mercerist: has joined #ruby
[06:43:29] blackmesa: has joined #ruby
[06:44:13] tmtwd: has joined #ruby
[06:44:16] dionysus69: has joined #ruby
[06:45:12] nankyokusei: has joined #ruby
[06:46:04] ramfjord: has joined #ruby
[06:49:34] Niham: has joined #ruby
[06:49:43] codecop: has joined #ruby
[06:50:02] dionysus69: has joined #ruby
[06:50:17] CloCkWeRX: has joined #ruby
[06:52:30] djbkd: has joined #ruby
[06:57:58] bigkevmcd: has joined #ruby
[06:58:39] kies: has joined #ruby
[06:59:22] giz|work: has joined #ruby
[07:00:21] k3rn31: has joined #ruby
[07:01:18] jgt1: has joined #ruby
[07:03:39] Zarthus: has joined #ruby
[07:04:08] certainty: has joined #ruby
[07:05:16] lsmola: has joined #ruby
[07:05:39] fenre_: has joined #ruby
[07:08:20] fenre__: has joined #ruby
[07:09:10] Hounddog: has joined #ruby
[07:10:42] n1x-nz: has joined #ruby
[07:10:52] DTZUBDUB: has joined #ruby
[07:11:23] evansbee: has joined #ruby
[07:16:07] bluOxigen: has joined #ruby
[07:17:18] bumao: has joined #ruby
[07:17:34] fenre: has joined #ruby
[07:20:14] xall: has joined #ruby
[07:20:15] neanderslob: has joined #ruby
[07:20:18] neanderslob_: has joined #ruby
[07:21:20] solars: has joined #ruby
[07:21:49] neanderslob: has joined #ruby
[07:22:41] tmtwd: has joined #ruby
[07:24:55] madgen: has joined #ruby
[07:26:15] zacstewart: has joined #ruby
[07:27:56] edwinvdgraaf: has joined #ruby
[07:29:52] charliesome: has joined #ruby
[07:30:07] xall_: has joined #ruby
[07:34:22] wsewolod: has joined #ruby
[07:35:46] jaguarmagenta: has joined #ruby
[07:36:11] ur5us: has joined #ruby
[07:37:01] tAn: has joined #ruby
[07:38:19] terlar: has joined #ruby
[07:38:27] karmatr0n: has joined #ruby
[07:41:08] astrobunny: has joined #ruby
[07:41:53] andikr: has joined #ruby
[07:42:56] kknight: has joined #ruby
[07:44:39] blackmesa: has joined #ruby
[07:45:41] mercerist: has joined #ruby
[07:45:58] harfangk: has joined #ruby
[07:46:49] biberu: has joined #ruby
[07:47:05] multi_io: has joined #ruby
[07:48:09] ngw: has joined #ruby
[07:49:10] aberen: has joined #ruby
[07:49:54] yfeldblum: has joined #ruby
[07:52:49] startupality: has joined #ruby
[07:54:13] startupality: has joined #ruby
[07:56:33] hutch34: has joined #ruby
[07:59:56] Silthias: has joined #ruby
[08:00:18] Coldblackice: has joined #ruby
[08:01:34] tesuji_: has joined #ruby
[08:02:35] ruby-lang193: has joined #ruby
[08:03:12] tvw: has joined #ruby
[08:04:03] Cyneyt: has joined #ruby
[08:04:17] giz|work: has joined #ruby
[08:05:12] vondruch: has joined #ruby
[08:08:08] symm-: has joined #ruby
[08:09:27] ljames: has joined #ruby
[08:09:49] jaruga___: has joined #ruby
[08:11:05] Kedare: has joined #ruby
[08:12:31] charliesome: has joined #ruby
[08:19:17] the_drow: has joined #ruby
[08:21:04] charliesome: has joined #ruby
[08:21:56] skade: has joined #ruby
[08:24:01] DoubleMalt: has joined #ruby
[08:24:07] rkoller: has joined #ruby
[08:25:56] Mon_Ouie: has joined #ruby
[08:25:57] araujo: has joined #ruby
[08:27:32] zacstewart: has joined #ruby
[08:28:46] DTZUBDUB: has joined #ruby
[08:29:43] hutch34: has joined #ruby
[08:30:41] mrgrieves: has joined #ruby
[08:33:32] startupality: has joined #ruby
[08:36:50] weckl: has joined #ruby
[08:38:55] Moosashi: has joined #ruby
[08:39:22] karmatr0n: has joined #ruby
[08:39:49] mikecmpbll: has joined #ruby
[08:40:02] giz|work: has joined #ruby
[08:40:16] ngw: has joined #ruby
[08:40:18] lxsameer: has joined #ruby
[08:41:41] mooru: has joined #ruby
[08:41:51] p1k: what is the JSON method to parse a string literal ? e.g. "42"
[08:42:24] marr: has joined #ruby
[08:42:44] mooru: has joined #ruby
[08:44:58] senayar: has joined #ruby
[08:44:58] senayar: has joined #ruby
[08:45:09] arlek: has joined #ruby
[08:45:11] apeiros: p1k: you'll have to use a non-standard-lib json library. ruby's json library still uses an older spec of json, where only objects and arrays are valid root elements.
[08:45:42] blackmesa: has joined #ruby
[08:46:01] nankyokusei: has joined #ruby
[08:46:46] apeiros: you can use JSON.load, but not sure about the security implications (its docs warn from using it on userinput)
[08:47:20] xpt: has left #ruby: ("too many buffers to handle :(")
[08:47:29] tesuji_: has joined #ruby
[08:49:54] salexa: has joined #ruby
[08:50:47] futilegames: has joined #ruby
[08:51:54] jgt1: has joined #ruby
[08:53:02] f4cl3y: has joined #ruby
[08:53:58] moeabdol: has joined #ruby
[08:54:22] Stan: has joined #ruby
[08:57:50] ocbtec: has joined #ruby
[08:58:06] solocshaw: has joined #ruby
[08:58:15] futilegames: has joined #ruby
[09:05:32] jancel: has joined #ruby
[09:07:29] rickmasta: has joined #ruby
[09:12:03] ur5us: has joined #ruby
[09:12:16] evansbee: has joined #ruby
[09:12:19] vuoto: has joined #ruby
[09:13:24] czerasz: has joined #ruby
[09:13:34] jinie: has joined #ruby
[09:14:55] workmad3: has joined #ruby
[09:16:49] tao_: has joined #ruby
[09:20:52] Infra-Red: has joined #ruby
[09:20:57] Moosashi: has joined #ruby
[09:23:06] araujo_: has joined #ruby
[09:25:16] salexa: has left #ruby: ("PART ##machinelearning :PART #learnprogramming :PART ##namespace :PONG :asimov.freenode.net")
[09:27:05] ferr1: has joined #ruby
[09:27:37] JoeSa: has joined #ruby
[09:28:15] zacstewart: has joined #ruby
[09:28:25] blackmesa: has joined #ruby
[09:31:26] hutch34: has joined #ruby
[09:34:12] JoeSa: has joined #ruby
[09:35:50] Niham: has joined #ruby
[09:37:00] guardianJ: has joined #ruby
[09:37:07] charliesome: has joined #ruby
[09:40:20] karmatr0n: has joined #ruby
[09:44:16] agentmeerkat: has joined #ruby
[09:44:34] madgen: has joined #ruby
[09:45:20] snowy: has joined #ruby
[09:45:33] fenre: has joined #ruby
[09:46:05] jaguarmagenta: has joined #ruby
[09:49:37] chip_: has joined #ruby
[09:50:39] guardianJ: has left #ruby: ()
[09:51:24] rikkipitt: has joined #ruby
[09:53:38] tAn: has joined #ruby
[09:53:38] sameerynho: has joined #ruby
[09:59:08] FooMunki: has joined #ruby
[10:02:37] workmad3: has joined #ruby
[10:03:35] marahin: Hello. Having an array of addresses, what is the proper way to find closest address from the array, when given another specific location?
[10:03:50] marahin: There is Geocoder, but as I see it requires Rails / something with models, and I want to keep it as simple as possible.
[10:04:27] Sashimi: has joined #ruby
[10:04:31] p1k: apeiros: I see, thanks
[10:06:02] madgen: has joined #ruby
[10:07:29] jhass: marahin: https://github.com/alexreisner/geocoder#use-outside-of-rails
[10:08:12] Sashimi: has joined #ruby
[10:08:22] jaguarmagenta: has joined #ruby
[10:08:56] marahin: jhass, uh... Pardon me, as I am a learning person: the method shown seems to be only searching for a place, and I particularly have to find a place from @array, that is closest to @another_place
[10:09:15] marahin: so in pseudocode I'd do like @array.closest( @another_place ) or something.
[10:09:49] jhass: I was just hinting the fact that while it's focused on usage inside AR, it is not required
[10:10:05] marahin: that is true
[10:10:14] harfangk: has joined #ruby
[10:10:20] platzhirsch: has joined #ruby
[10:10:22] marahin: and I am aware of that :( it's just that it's rather a CLI program, I don't need (and want ActiveRecord) for that
[10:10:39] marahin: so, any idea how can I bite this?
[10:11:04] platzhirsch: What's the nicest way of adding a constant for a long string which you can break over multiple lines without
[10:11:12] platzhirsch: \n are added to it?
[10:11:12] CloCkWeRX: has joined #ruby
[10:12:23] jhass: platzhirsch: you can use \ at the end of a line inside "", %() and heredocs too
[10:13:34] platzhirsch: jhass: that seems reasonable
[10:14:55] jhass: marahin: map all your addresses to geo coordinates using search, then to distances using Geocoder::Calculations.distance_between and then just #min_by
[10:16:37] tao_: has joined #ruby
[10:16:47] p0p0pr37: has joined #ruby
[10:17:14] dionysus69: has joined #ruby
[10:17:35] Gasher: has joined #ruby
[10:18:31] c355E3B: has joined #ruby
[10:18:38] fenre: has joined #ruby
[10:18:42] jhass: uh, nice https://bugs.ruby-lang.org/issues/10085
[10:19:01] Macaveli: has joined #ruby
[10:19:06] apeiros: ACTION wonders whether a KD-tree would/could work with geocoords
[10:19:22] apeiros: ACTION off - cya all :)
[10:19:33] lupine: apeiros: just use postgres :p
[10:20:03] Rinzlit: has left #ruby: ("Got Cancer and died")
[10:20:46] mdw: has joined #ruby
[10:23:30] Sashimi: has joined #ruby
[10:25:06] blackgoat: has joined #ruby
[10:29:13] CloCkWeRX: has joined #ruby
[10:29:31] DTZUBDUB: has joined #ruby
[10:30:13] zacstewart: has joined #ruby
[10:30:46] diegoaguilar: has joined #ruby
[10:33:31] jaguarmagenta: has joined #ruby
[10:33:34] sdothum: has joined #ruby
[10:34:16] giz|work: has joined #ruby
[10:36:58] sepp2k: has joined #ruby
[10:41:23] karmatr0n: has joined #ruby
[10:42:30] charliesome: has joined #ruby
[10:45:16] jaguarmagenta: has joined #ruby
[10:46:54] nankyokusei: has joined #ruby
[10:52:02] CloCkWeRX: has joined #ruby
[10:53:34] GodFather: has joined #ruby
[10:56:27] yeticry: has joined #ruby
[10:56:50] johnmilton: has joined #ruby
[10:58:18] Dysp: has joined #ruby
[10:58:50] Dysp: Hi there fellas. I have an array [1, 2, 3, 4, 5]. Is there anyway to iterate over them but always skipping the first?
[10:58:56] Dysp: I know there is.
[10:59:25] ltd: [1,2,3,4,5][1..-1].each { ... } ?
[11:00:12] Dysp: I don't think I quite understand the syntax here.
[11:00:24] ltd: irb(main):001:0> [1,2,3,4,5][1..-1].each { |i| p i }
[11:00:45] Dysp: I see, okay. Thx!
[11:01:04] gnufied: has joined #ruby
[11:01:07] ltd: the [] method of array supports range object
[11:01:17] ltd: 1..-1 is second element to last element
[11:01:33] ltd: and when given a range it will return an array
[11:01:40] Dysp: Yes, that was what I just needed to understand. I got it now :)
[11:01:45] diegoaguilar: has joined #ruby
[11:02:12] ltd: or drop, yes
[11:06:49] freerobby: has joined #ruby
[11:09:24] rodfersou: has joined #ruby
[11:10:00] charliesome: has joined #ruby
[11:10:19] airmac: has joined #ruby
[11:11:21] Vingador: has joined #ruby
[11:11:23] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:23] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:24] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:24] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:24] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:25] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:25] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:26] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:26] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:27] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:27] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:28] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:28] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:29] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:29] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:30] airmac: https://www.eobot.com/new.aspx?referid=208540
[11:11:32] airmac: has left #ruby: ()
[11:13:09] evansbee: has joined #ruby
[11:15:38] ornerymoose: has joined #ruby
[11:16:32] GodFather: has joined #ruby
[11:17:02] Icey: has joined #ruby
[11:18:41] jhass: !spam airmac
[11:18:44] ruby[bot]: +bb airmac!*@*$#ruby-banned *!*@paris-s06-i02.cg-dialup.net$#ruby-banned
[11:24:13] Vingador_: has joined #ruby
[11:25:55] Dysp: Okay, stuck another (for me) hard one. I have an array [1, 2, 3, 4] for each element I want to divide by each element in another array [0, 1, 2, 3, 4], starting from the 1st position. (Not 0th).
[11:26:36] Dysp: Using map would work, but how I get the other array into work I can't figure out
[11:27:33] diegoaguilar: has joined #ruby
[11:28:47] lupine: you could zip then map
[11:29:22] DTZUBDUB: has joined #ruby
[11:30:03] jhass: Dysp: starting from the 1st position of both arrays or just shifting the other by 1?
[11:30:37] Dysp: No, only the second one.
[11:30:41] jhass: as.zip(bs.drop(1)).map {|a, b| a / b }
[11:31:03] Dysp: I'll try to understand it :d
[11:31:42] lupine: the first time I came across Array#zip, I thought "why?!?!"
[11:31:44] jhass: alternative: as.map.with_index(1) {|a, i| a / bs[i] }
[11:31:49] hutch34: has joined #ruby
[11:32:09] Dysp: If it wasn't for you guys, I would never have learned to program.
[11:32:26] Dysp: I consider myself a proud phase 2 newb now ^^
[11:33:11] diegoaguilar: has joined #ruby
[11:33:39] Dysp: After reading the api for zip, I now know exactly as little as I did when I started reading the api.
[11:34:15] mradmacher: has joined #ruby
[11:34:40] ltd: it's a confusing function, i'll admit
[11:34:58] Dysp: Some day. :d
[11:35:38] joneshf-laptop: has joined #ruby
[11:35:57] ltd: one i've not had an application for yet tbh
[11:37:54] fenre_: has joined #ruby
[11:38:28] tesuji_: has joined #ruby
[11:39:05] jhass: the most common real world usecase is something like keys.zip(values).to_h
[11:40:30] rikkipitt: has joined #ruby
[11:40:34] senayar: has joined #ruby
[11:40:49] d0lph1n98: has joined #ruby
[11:41:33] tesuji_: has joined #ruby
[11:42:16] karmatr0n: has joined #ruby
[11:46:33] blackmesa: has joined #ruby
[11:50:40] dionysus69: has joined #ruby
[11:50:44] Hanmac: has joined #ruby
[11:51:46] ldnunes: has joined #ruby
[11:54:34] bigkevmcd: has joined #ruby
[11:54:50] ornerymoose: has joined #ruby
[11:54:59] SirOliver: has joined #ruby
[11:57:15] ddv: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[11:59:31] pawnbox: has joined #ruby
[12:01:28] jenrzzz: has joined #ruby
[12:01:29] jenrzzz: has joined #ruby
[12:01:47] madgen: has joined #ruby
[12:02:43] gnufied: has joined #ruby
[12:03:24] axxyhtrx: has joined #ruby
[12:03:35] guardianJ: has joined #ruby
[12:04:01] synthroid: has joined #ruby
[12:06:37] hutch34: has joined #ruby
[12:06:56] c0mrad3: has joined #ruby
[12:08:28] moos3: has joined #ruby
[12:09:10] GinoManWorks: has joined #ruby
[12:11:02] flughafen_: has joined #ruby
[12:14:53] irick: has joined #ruby
[12:14:54] Canucktux: has joined #ruby
[12:15:45] pabs: has joined #ruby
[12:16:02] jtd: has joined #ruby
[12:16:15] juanfra: has joined #ruby
[12:16:15] fmcgeough: has joined #ruby
[12:16:15] jamo: has joined #ruby
[12:16:18] johnmilton: has joined #ruby
[12:16:59] arthurnn: has joined #ruby
[12:17:03] RazorX: has joined #ruby
[12:17:21] Weavel: has joined #ruby
[12:18:13] low-profile: has joined #ruby
[12:18:33] k13nox: has joined #ruby
[12:18:38] cfillion: has joined #ruby
[12:18:40] xall_: has joined #ruby
[12:18:47] atom3: has joined #ruby
[12:19:21] Mon_Ouie: has joined #ruby
[12:19:43] jenrzzz: has joined #ruby
[12:19:43] jenrzzz: has joined #ruby
[12:19:46] chrisarcand: has joined #ruby
[12:19:51] duracrisis: has joined #ruby
[12:19:59] z3uS: has joined #ruby
[12:20:02] abort: has joined #ruby
[12:20:13] bhaak: has joined #ruby
[12:20:14] ytti: has joined #ruby
[12:20:15] GinoManWorks: has joined #ruby
[12:20:17] pawnbox: has joined #ruby
[12:20:18] spacemud: has joined #ruby
[12:20:19] gregf_: has joined #ruby
[12:20:25] bitemyapp: has joined #ruby
[12:20:44] aryaching: has joined #ruby
[12:21:46] Karunamon: has joined #ruby
[12:22:31] shaman42: has joined #ruby
[12:22:46] scottschecter: has joined #ruby
[12:22:58] fenre: has joined #ruby
[12:23:08] hfp: has joined #ruby
[12:24:26] agentmeerkat: has joined #ruby
[12:24:46] Akuma: has joined #ruby
[12:27:34] codecop: has joined #ruby
[12:28:22] SirOliver: has joined #ruby
[12:29:03] biox: has joined #ruby
[12:29:19] yardenbar: has joined #ruby
[12:31:38] greg: has joined #ruby
[12:31:55] Tempesta: has joined #ruby
[12:32:15] iamayam: has joined #ruby
[12:33:37] DTZUBDUB: has joined #ruby
[12:34:16] roamingdog: has joined #ruby
[12:34:23] DoubleMalt: has joined #ruby
[12:34:56] zacstewart: has joined #ruby
[12:35:45] Gasher: has joined #ruby
[12:36:22] Riba: has joined #ruby
[12:36:24] yasu___: has joined #ruby
[12:36:50] aupadhye: has joined #ruby
[12:37:30] Infra-Red: has joined #ruby
[12:40:11] mshowman: has joined #ruby
[12:41:21] armyriad: has joined #ruby
[12:41:51] jancel: has joined #ruby
[12:43:07] shinnya: has joined #ruby
[12:43:13] karmatr0n: has joined #ruby
[12:45:42] mattp_: has joined #ruby
[12:45:58] wldcordeiro: has joined #ruby
[12:46:36] jgt1: has joined #ruby
[12:46:37] tmi1: has joined #ruby
[12:47:38] aryaching: has joined #ruby
[12:47:48] nankyokusei: has joined #ruby
[12:48:24] chip_: has joined #ruby
[12:48:45] xcesariox: has joined #ruby
[12:54:06] Fernando-Basso: has joined #ruby
[12:55:30] Yiota: has joined #ruby
[12:58:00] emilkarl: has joined #ruby
[12:58:45] ChiefAlexander: has joined #ruby
[13:00:40] TTilus: has joined #ruby
[13:01:18] Icey: has joined #ruby
[13:01:59] garethrees: has joined #ruby
[13:03:17] Sashimi: has joined #ruby
[13:04:09] fenre: has joined #ruby
[13:05:15] jgt1: has joined #ruby
[13:05:47] blackmesa: has joined #ruby
[13:08:47] ruby-lang386: has joined #ruby
[13:09:21] gfvcastro: has joined #ruby
[13:09:25] pandaant: has joined #ruby
[13:10:30] shadeslayer: has joined #ruby
[13:10:57] johnny56: has joined #ruby
[13:12:02] joast: has joined #ruby
[13:12:04] CustosLimen: I'm not sure how to get rb_backtrace in gdb
[13:12:56] crankharder: can someone explain why 'assert' is undefined when this proc is called, but not in the lines immediately above it? https://gist.github.com/anonymous/fbf16511cf6ea6f25e5feef5606d7221
[13:13:47] M-shine: has joined #ruby
[13:14:22] CustosLimen: oh wait nvm got it
[13:14:23] ChiefAlexander_: has joined #ruby
[13:14:54] workmad3: crankharder: because the `should` block is being instance_evaled on an instance of a test class that provides `assert`, whilst your proc is being run with the context of the top-level TestCase class (which doesn't have access to `assert`)
[13:15:54] someish: has joined #ruby
[13:16:08] eljimbo: has joined #ruby
[13:16:50] imperator: has joined #ruby
[13:18:24] crankharder: workmad3: seems odd to me that the context switches
[13:18:38] crankharder: curious if you see a workaround?
[13:19:20] snath: has joined #ruby
[13:20:08] Mon_Ouie: instance_eval(&p), or pass self as a parameter to p
[13:20:11] norc: crankharder: instance eval the block
[13:20:14] norc: ACTION sighs.
[13:20:24] norc: ACTION is just too slow for this world.
[13:21:56] agentmeerkat: has joined #ruby
[13:24:54] M-Kodo: has joined #ruby
[13:25:24] troulouliou_div2: has joined #ruby
[13:25:57] Hounddog: has joined #ruby
[13:26:25] craigp: has joined #ruby
[13:28:57] CJKinni: has joined #ruby
[13:29:51] jrafanie: has joined #ruby
[13:30:34] CJKinni: has joined #ruby
[13:31:17] aryaching: has joined #ruby
[13:32:29] mattwashere: has joined #ruby
[13:33:16] dionysus69: has joined #ruby
[13:33:20] frem_: has joined #ruby
[13:34:53] malconis: has joined #ruby
[13:35:56] zacstewart: has joined #ruby
[13:39:11] nettoweb: has joined #ruby
[13:41:13] SilverKey: has joined #ruby
[13:41:19] roamingdog: has joined #ruby
[13:41:43] jenrzzz: has joined #ruby
[13:41:43] jenrzzz: has joined #ruby
[13:42:28] blackmes1: has joined #ruby
[13:44:17] karmatr0n: has joined #ruby
[13:45:34] hutch34: has joined #ruby
[13:45:44] roundabout22: has joined #ruby
[13:45:58] madgen: has joined #ruby
[13:46:27] ChiefAlexander: has joined #ruby
[13:46:54] modin: has joined #ruby
[13:46:57] aegis3121: has joined #ruby
[13:47:30] M-mistake: has joined #ruby
[13:51:38] madgen: has joined #ruby
[13:53:29] bmurt: has joined #ruby
[13:54:17] prestorium: has joined #ruby
[13:55:15] snath: has joined #ruby
[13:55:41] ponga: has joined #ruby
[13:56:58] karmatr0n: has joined #ruby
[13:58:17] giz|work: has joined #ruby
[13:58:32] rikkipitt: has joined #ruby
[13:58:35] gettalong: has joined #ruby
[13:58:47] Dysp: jhass: Am I so lucky that you are available at this very moment?
[13:58:52] AlexRussia: has joined #ruby
[13:59:43] jhass: Dysp: just ask your question, don't focus on people to answer them
[14:00:26] iCHAIT_: has left #ruby: ()
[14:00:29] Dysp: Haha, I have no question. You are just my favorite grammar nazi and I've refactored my code; hopefully for the better. I was wondering if you would take a look at it and yell at me, like you normally do!
[14:00:50] Dysp: (And I can't access gist because of slow internet atm, so I cannot just post..)
[14:01:42] joonty: has joined #ruby
[14:03:18] tAn: has joined #ruby
[14:04:31] karmatr0n: has joined #ruby
[14:04:33] jhass: "Can I get this code reviewed?" is a perfectly fine, open question
[14:04:49] Dysp: https://gist.github.com/Dysp/34dbaa317a90c5636ee068c1f049238b - How does my code look? Should I do stuff differently? Is it readable? Formatting? Am I using the correct variables, etc. etc?
[14:05:17] snowy: has joined #ruby
[14:06:17] Mon_Ouie: #extract_values can be rewritten using sheets.map { … } instead of building an array explicitly
[14:06:29] pocketprotector: has joined #ruby
[14:07:01] d10n-work: has joined #ruby
[14:07:15] Dysp: I actually do have a specific question. All these "nested" functions - is there a proper way of ordering them? I mean; some functions are divided into subfunctions and my natural intuition would tell me do indent these, so it shows. But is this bad practice?
[14:07:23] Dysp: Mon_Ouie: I'll take a look! Ty
[14:08:27] Mon_Ouie: You mean if one method calls another method?
[14:09:13] aegis3121: On your ifs, unless you really need to check against booleans, no need to check == true. if positive?(val) is the same as if positive?(val) == true in terms of truthiness
[14:09:19] Mon_Ouie: I would usually put the high-level API at the top and utility methods used to define these methods at the end (possibly indicating them as private)
[14:09:23] Dysp: I mean like.. I have one function called "calculate", which again uses a shit tonne of other functions. These other functions would never be used by anything else.
[14:09:46] Dysp: Oh, yeah, the truthiness is implicit, right?
[14:09:56] aegis3121: You can always make a second class that handles the calculations
[14:10:13] aegis3121: then it looks less cluttered in this class by pulling it into the class that needs to know how to do that.
[14:10:35] aegis3121: Dysp: yup. Anything except nil and false is truthy.
[14:10:48] Dysp: Ah okay, so there isn't really any proper way of doing it. Seems like it depends on what you demand from it.
[14:10:50] jhass: Dysp: Clean Code recommends to put the highest level methods at the start and order the other methods in call order below them; so def public_api; a; b; end; private; def a; end; def b; end;
[14:11:19] Dysp: Alrighty.
[14:11:25] jhass: that is order of first call
[14:11:45] jhass: that usually naturally leads to something you can read top down
[14:12:07] Dysp: Another question for ya'll.
[14:12:20] aegis3121: #positive? doesn't need the if/else; `array.inject(:+).quo(array.size) > 0` would be sufficient for the entire method
[14:12:49] axl_: has joined #ruby
[14:13:19] Dysp: Now I have created an object with the instance variables I need; how do access these variables? I've seen that you can access these via "instance get" or something. But then I was told that wasn't a good way of doing it?
[14:13:40] aegis3121: creating attr_reader :name_of_ivar would work
[14:13:42] Dysp: I cannot search the interwebs right now, as I think the web/DNS/whatever of my workplace is crashing
[14:14:10] Dysp: So it is the attr_reader I need to read up on.
[14:14:12] SilverKey: has joined #ruby
[14:14:16] aegis3121: then use it like any other method name. attr_reader :something; def foobar; puts something; end
[14:15:01] pocketprotector: has joined #ruby
[14:15:36] Dysp: If I were to use something like foobar.r1.mvc, would I need to create that sort of API?
[14:15:47] Dysp: To extract the mvc from r1.
[14:15:50] ebbflowgo: has joined #ruby
[14:16:29] Dysp: Right now it is {right => {"r1" => {.... mvc: mvc... }...}
[14:16:56] palms: has joined #ruby
[14:17:02] aegis3121: you would need to make r1 an object rather than a hash, yes. Otherwise accessing it like a hash would work.
[14:17:16] dangerou_: has joined #ruby
[14:17:34] hk238: has joined #ruby
[14:17:36] swills: has joined #ruby
[14:17:42] Dysp: r1 is a hash within a hash within a hash right now.
[14:17:58] Dysp: You are saying I should somehow pull it out and make it its own object when called upon?
[14:18:51] aegis3121: If you want to access it like that, yes. If you're fine doing hash[:right]['r1'][:mvc], then I'd leave it like that. It's personal preference, though objects are nicer. Just have to weight out if the effort is worth any benefits.
[14:18:55] chip_: has joined #ruby
[14:20:15] Dimik: has joined #ruby
[14:20:20] Dysp: Well, eventually I will be creating some kind of frontend that should be able to pull every single tiny detail.
[14:20:43] Dysp: Hopefully fully customizable.
[14:21:16] Dysp: To be honest I don't know which approach to go with. Eventually I will of course just go with whatever works and then refactor when I learn more.
[14:21:45] jhass: Dysp: rename all variables until none of them have the words array or hash in them. Name them after the data they represent, not its structure
[14:22:19] jhass: Array[] is a rather verbose way to write []
[14:22:29] Dysp: You are right and I will do that. I simply did call them something with array/hash, so I could find my own way around them.
[14:23:06] gfvcastro: has joined #ruby
[14:23:09] jaguarmagenta: has joined #ruby
[14:23:13] jhass: ll 122-125 want to be a .map too
[14:23:42] agent_white: has joined #ruby
[14:23:57] Dysp: Be aware; I am noting these things down :)
[14:23:58] jhass: each.with_index -> each_with_index
[14:24:11] Dysp: Any difference?
[14:24:17] diegoviola: has joined #ruby
[14:24:21] jhass: creates one less Enumerator instance
[14:24:39] jhass: or actually in this case just .map.with_index
[14:25:18] jhass: what's line 65 trying to do?, copy?
[14:25:31] Dysp: What does the line start with?
[14:25:33] rikkipitt: has joined #ruby
[14:25:33] Dysp: I posted comments
[14:25:38] Dysp: fucked up the line numbers
[14:25:52] jhass: first in def baseline
[14:26:14] jhass: data.first(100) already returns a new array
[14:26:25] Dysp: It's from the old script.
[14:26:48] Dysp: baseline = data.first(100)
[14:26:51] Dysp: Better, right?
[14:27:15] jhass: data.reject!.each_with_index -> data.reject!.with_index
[14:27:58] jhass: less noisy?
[14:28:18] Dysp: yes, sure. But doesn't the iteration come from the .each call?
[14:28:21] jhass: the each_ made me think you have useless each loop in the first second
[14:28:57] jhass: that reject! iterates is quite obvious
[14:29:53] jancel: has joined #ruby
[14:31:43] davedev24: has joined #ruby
[14:31:44] joast: has joined #ruby
[14:32:20] Dysp: Alrighty. Also found a bug while at it.. Gotta work that bad boy out
[14:32:24] Dysp: ty for all ya help
[14:32:30] mdw: has joined #ruby
[14:33:15] mdw: has joined #ruby
[14:34:17] SolarSailor: has joined #ruby
[14:34:40] iCHAIT_: has joined #ruby
[14:36:03] tjohnson: has joined #ruby
[14:36:50] zacstewart: has joined #ruby
[14:37:25] mikecmpb_: has joined #ruby
[14:40:45] Dysp: Considering I have a long-ass array with data (data), why does this: [0, 1, 2, 3, 4].each do { |t| array << data.fetch(t. nil) } return an array with [0, 1, 2, 3, 4]?
[14:40:59] Dysp: Oh, the dot should be a comma.
[14:41:06] Dysp: Typing mistake
[14:42:28] bmurt: has joined #ruby
[14:42:44] jenrzzz: has joined #ruby
[14:43:27] SilverKey: has joined #ruby
[14:43:29] zacstewart: has joined #ruby
[14:43:44] rippa: has joined #ruby
[14:43:50] emilkarl: has joined #ruby
[14:44:18] apeiros: Dysp: because .each always returns the receiver
[14:45:10] Dysp: So I need just to return the array?
[14:45:25] Dysp: Which I append to
[14:45:41] apeiros: I don't know what you need.
[14:45:45] Dysp: Thank you, my light and savior.
[14:45:58] Dysp: Oh sorry. Shared the code earlier, forgot that this was asked out of context
[14:46:11] polishdub: has joined #ruby
[14:47:35] mooru: has joined #ruby
[14:48:23] CloCkWeRX: has left #ruby: ()
[14:48:37] nankyokusei: has joined #ruby
[14:49:09] tao_: has joined #ruby
[14:49:23] jhass: Dysp: again, that's a .map
[14:50:09] Dysp: Yeah, I am starting to get it ^^
[14:50:11] jhass: or in this special case it's even a Array.new(5) {|t| }
[14:51:22] mercerist: has joined #ruby
[14:52:55] jmignault: has joined #ruby
[14:53:29] pawnbox: has joined #ruby
[14:54:05] dionysus69: has joined #ruby
[14:54:39] e3c: has joined #ruby
[14:55:25] ChiefAlexander: has joined #ruby
[14:55:39] lalalaaa: has joined #ruby
[14:56:11] Dysp: I am now starting to get back "inifity" when dividing by numbers that do definetly not equal to anything near infinity. Why is this?!
[14:56:50] jrafanie_: has joined #ruby
[14:57:00] Dysp: If I do 34,9 / 0,05 I am getting "infinity".
[14:57:28] spiette: has joined #ruby
[14:58:09] Dysp: Must be the code, though. ms_dif_nm.map!.with_index(1) { |a, i| a / (@time_values[i] / 1000) }
[14:58:25] toretore: >> 34.9 / 0.05
[14:58:27] ruby[bot]: toretore: # => 697.9999999999999 (https://eval.in/592210)
[14:58:37] lalalaaa: Based on http://www.rubydoc.info/gems/tweetstream/TweetStream/Client -- how would'd I go about ignoring retweets? https://gist.github.com/anonymous/8d1b34e04a1d011d5bc250cbe4e7b896
[14:59:40] vuoto: has joined #ruby
[15:00:23] SolarSailor: has joined #ruby
[15:01:53] chip_: has joined #ruby
[15:02:00] CJKinni`: has joined #ruby
[15:03:02] Yiota: has joined #ruby
[15:03:04] kobain: has joined #ruby
[15:03:27] Dysp: [11.99, 34.94, 88.99, 79.70]map!.with_index(1) { |a, i| a / ([0, 30, 50, 100, 200][i] / 1000) }
[15:03:47] Dysp: This is giving me plentiful of inifinities. Ohhh whyaaaaaay?!
[15:04:09] fujinuma: has joined #ruby
[15:05:01] Mon_Ouie: a / (0 / 1000) == (a / 0)
[15:05:28] Dysp: Mon_Ouie: Please elaborate.
[15:05:36] beneggett: has joined #ruby
[15:06:19] Mon_Ouie: >> 30 / 1000
[15:06:21] ruby[bot]: Mon_Ouie: # => 0 (https://eval.in/592216)
[15:06:26] CloCkWeRX: has joined #ruby
[15:06:31] Dysp: The fixnum trap?
[15:06:40] toretore: why are you doing with_index(1) ?
[15:06:42] Mon_Ouie: And division by zero for floating point numbers is defined to be an infinity
[15:07:03] Dysp: toretore: I am not sure exactly what I am doing here. Let me explain.
[15:08:15] Dysp: I am trying to: For each element in 'a' divide by each element in 'b' (divided by 1000).
[15:08:28] Dysp: Except the 1st element, which is 0.
[15:08:54] Dysp: So start from "1", not "0". Does it make sense?
[15:09:06] tcopeland: has joined #ruby
[15:09:29] beneggett: has joined #ruby
[15:09:31] mensvaga: has left #ruby: ()
[15:11:03] Dysp: Mon_Ouie: You were of course right. The fixnum trap, as I call it.
[15:11:10] dsea: has joined #ruby
[15:11:27] Xeago_: has joined #ruby
[15:11:35] toretore: Dysp: need more context
[15:12:03] `tim`: has joined #ruby
[15:12:17] mattwashere: has joined #ruby
[15:12:20] Dysp: If you want to know, I will tell you. But Mon_Ouie made me realize what is wrong and it now works.
[15:13:26] blackmes1: has joined #ruby
[15:13:40] roamingdog: has joined #ruby
[15:16:34] mikecmpbll: has joined #ruby
[15:17:32] Mattx: has joined #ruby
[15:18:09] Mattx: Hey guys, any of you using MongoDB? I want to give it a try but I've found the documentation of the gem "mongo" is awful and in many cases outdated. Any idea?
[15:18:39] kareeoleez: has joined #ruby
[15:18:58] Mattx: for instance there's a method called #hint(hash) to query documents, but all the doc says is "Provides the query with an index hint to use."
[15:19:03] SilverKey: has joined #ruby
[15:19:04] rikkipitt: has joined #ruby
[15:19:11] Papierkorb: Mattx: https://docs.mongodb.com/ecosystem/tutorial/ruby-driver-tutorial/ the mongodb people have a extensive tutorial for their stuff, including the ruby gem
[15:19:38] tAn: has joined #ruby
[15:19:40] Mattx: Papierkorb, that's what I'm reading. check the example above. how are you supposed to use .hint?
[15:19:48] Polysics: has joined #ruby
[15:20:09] Mattx: or even #batch_size(integer), something way more useful
[15:20:15] Mattx: what's the default value? no idea...
[15:20:20] Papierkorb: I just used #find for my 10 queries or so I ever needed to do with mongo
[15:20:49] kareeoleez: has joined #ruby
[15:21:07] Papierkorb: if there is no default given, you have to pass it anyway. if one is given and it is nil, it's probably a server selected value or so.
[15:21:28] Mattx: well, my point is that it's not documented
[15:21:43] Mattx: using find() surely selects a default batch_size
[15:22:10] Mattx: or probably not, who knows :P
[15:22:31] roamingdog: has joined #ruby
[15:24:20] rikkipitt: has joined #ruby
[15:24:34] l4v2: has joined #ruby
[15:24:48] pawnbox: has joined #ruby
[15:26:19] l4v2: I am trying to do a tutorial for practicing testing, but when I run this command ‘bundle exec ruby tests/array_test.rb’ I get this error message -bash: /usr/local/bin/bundle: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
[15:27:17] l4v2: It’s a unsupported version of Ruby now too 1.9.3
[15:27:30] SolarSailor: has joined #ruby
[15:28:13] AcidCrash: has joined #ruby
[15:28:24] crystal77: has joined #ruby
[15:30:04] tesuji_: has joined #ruby
[15:30:59] jhack: has joined #ruby
[15:32:59] k3rn31: has joined #ruby
[15:33:16] wrkrcoop: has joined #ruby
[15:33:39] pawnbox: has joined #ruby
[15:34:22] pietr0: has joined #ruby
[15:38:25] banister: has joined #ruby
[15:39:56] spiette: has joined #ruby
[15:43:06] emilkarl: has joined #ruby
[15:44:11] ltd: has joined #ruby
[15:44:39] bmurt: has joined #ruby
[15:44:39] jenrzzz: has joined #ruby
[15:44:40] jenrzzz: has joined #ruby
[15:46:26] hk238: has joined #ruby
[15:46:39] synthroid: has joined #ruby
[15:47:05] gfvcastro: has joined #ruby
[15:47:18] ChiefAlexander: has joined #ruby
[15:48:03] solars: has joined #ruby
[15:48:53] ItSANgo__: has joined #ruby
[15:49:02] wrkrcoop: from inside my ec2 instance i can get in irb and connect to S3, but for some reason in my app I can’t connect to S3 … any idaes on why this might be?
[15:50:18] moos3: has joined #ruby
[15:53:15] imperator: suggestions for handling an arbitrary list of (hash-based) filters on an array of complex objects?
[15:54:03] imperator: right now i'm just iterating over the hash like: filter.each{ |k,v| list = list.select{ |x| x.send(k) == v } }
[15:54:37] imperator: but i suspect there's a better way
[15:56:37] jgt1: has joined #ruby
[15:56:49] hutch34: has joined #ruby
[15:56:53] cevett: has joined #ruby
[15:57:11] nerium: has joined #ruby
[15:59:36] kies: has joined #ruby
[15:59:49] snowy: has joined #ruby
[16:00:58] bhjcps: has joined #ruby
[16:01:23] rkazak: has joined #ruby
[16:01:38] mooru_: has joined #ruby
[16:02:22] yardenbar: has joined #ruby
[16:04:34] maucar: has joined #ruby
[16:05:20] kareeole_: has joined #ruby
[16:06:33] Yiota_: has joined #ruby
[16:06:36] dhollinger: has joined #ruby
[16:06:53] amclain: has joined #ruby
[16:07:03] eGGshke: has joined #ruby
[16:08:42] `tim`: has joined #ruby
[16:09:26] jhass: mh, don't see anything much better, could list.select {|item| filters.all? {|field, expected_value| item.public_send(field) == expected_value } }
[16:09:33] GodFather: has joined #ruby
[16:09:39] jhass: that'd at least short-circuit
[16:09:53] jhass: and allocate less
[16:10:07] conta: has joined #ruby
[16:10:26] KCmetro: has joined #ruby
[16:10:46] hogetaro_: has joined #ruby
[16:12:09] bencc: has joined #ruby
[16:12:32] bencc: "gem install rouge -V" is stuck at
[16:12:37] bencc: Parsing documentation for rouge-2.0.1
[16:12:42] bencc: Parsing sources...
[16:12:46] bencc: 45% [109/240] lib/rouge/formatters/html_pygments.rb
[16:13:10] bencc: jhass: cpu is close to 100% but I don't see progress
[16:13:15] weemsledeux: has joined #ruby
[16:13:28] cpruitt: has joined #ruby
[16:13:29] bencc: few mintues
[16:13:48] bencc: ruby 2.3.0p0, ubuntu 16.04
[16:13:58] jhass: "few minutes" tells me nothing
[16:14:17] crystal77: has joined #ruby
[16:14:18] bencc: jhass: maybe I don't understand your question. since what?
[16:14:31] jhass: 2 minutes? 10?
[16:14:35] jrafanie: has joined #ruby
[16:14:44] bencc: jhass: 5 mintues. I can wait more
[16:14:55] jhass: I'd give it 10
[16:15:05] bencc: I'll see you in 10 mintues :)
[16:15:09] jhass: if you don't actually need the docs just --no-doc
[16:15:26] bencc: jhass: I don't need the docs. trying without them
[16:15:39] cdg: has joined #ruby
[16:15:47] jhass: eh actually it's --no-document or -N for short
[16:15:54] bencc: looks good
[16:15:59] iCHAIT_: has left #ruby: ()
[16:16:06] GodFather: has joined #ruby
[16:16:11] [Butch]: has joined #ruby
[16:16:57] xall_: has joined #ruby
[16:18:04] jancel: has joined #ruby
[16:18:06] SCHAAP137: has joined #ruby
[16:19:51] VectorX: has joined #ruby
[16:20:12] VectorX: hi, im running unicorn on a port, is it possible to add basicauth to this ?
[16:20:59] gzn: has joined #ruby
[16:21:07] craigp: has joined #ruby
[16:23:31] TomyLobo: has joined #ruby
[16:23:43] jaguarmagenta: has joined #ruby
[16:24:38] shadeslayer: has joined #ruby
[16:25:00] diegoaguilar: has joined #ruby
[16:25:38] havenwood: VectorX: A Rack app? Rack ships with basic auth support. Take a look at the protectedlobster examples: https://github.com/rack/rack/tree/master/example
[16:25:48] coolboy: has joined #ruby
[16:25:51] borodin: has joined #ruby
[16:26:08] jgt: has joined #ruby
[16:26:47] havenwood: vcoinminer: https://github.com/rack/rack/blob/master/lib/rack/auth/basic.rb
[16:26:48] havenwood: oops, misstell
[16:26:56] blandflakes: has joined #ruby
[16:27:03] roamingdog: has joined #ruby
[16:28:21] VectorX: havenwood thanks
[16:29:33] moeabdol: has joined #ruby
[16:30:04] the_drow: has joined #ruby
[16:32:30] ramfjord: has joined #ruby
[16:33:21] iCHAIT_: has joined #ruby
[16:36:23] GodFather: has joined #ruby
[16:38:49] CustosLimen: so I want something that I can use to handle graceful shutdown - I made ShutdownHandler with wait method - so then I do shutdown_handler = ShutdownHandler.new - which traps signals with queue push... - and then I have wait method on ShutdownHandler that does queue.pop
[16:39:07] gfvcastro: has joined #ruby
[16:39:14] CustosLimen: http://termbin.com/1jva
[16:39:21] CustosLimen: the thing is though - this is not working really
[16:39:45] CustosLimen: https://bpaste.net/raw/530857ffc3c6
[16:39:48] RegulationD: has joined #ruby
[16:39:53] Moosashi: has joined #ruby
[16:39:54] CustosLimen: the @queue.pop never returns
[16:40:07] CustosLimen: even though stuff is being added to queue
[16:40:09] kareeoleez: I have a gem which can be installed only in specific systems (RPI, gem: dht-sensor-ffi) and the only way to use it in my development vm is to comment it out each time. Is there any other way to control this ?
[16:40:18] CustosLimen: I think this is maybe consequence of this all happening in one threads though
[16:43:21] Veejay: Try to use queue.pop(true) and see if an exception is raised
[16:43:23] CustosLimen: let me just send it to another thread
[16:43:39] Vingador: has joined #ruby
[16:43:39] CustosLimen: Veejay, it will be as queue will be empty first time its called
[16:44:09] Veejay: If the queue is empty, queue.pop suspends the calling thread
[16:44:23] CustosLimen: Veejay, yes - but the queue gets filled every time I send ctrl+c
[16:44:42] VectorX: has left #ruby: ()
[16:45:00] CustosLimen: Veejay, and in output (shared in bpaste) you can see queue getting bigger - but still pop does not return
[16:45:13] CustosLimen: anyway - I'm pretty sure it wont work if its all in one thread
[16:45:23] jenrzzz: has joined #ruby
[16:45:24] CustosLimen: I think this is what this proposal is about: https://bugs.ruby-lang.org/issues/8823
[16:45:35] CustosLimen: so I have to redirect the queue to another thread
[16:45:41] CustosLimen: and then redirect the event back to main thread
[16:46:56] madgen: has joined #ruby
[16:47:29] hogetaro: has joined #ruby
[16:47:34] jhass: kareeoleez: you could add an environment variable to skip the check
[16:47:51] jhass: MY_GEM_SKIP_PLATFORM_CHECK=true
[16:48:00] shevy: HERE_BE_DRAGONS=true
[16:48:05] kareeoleez: there's also grouping and --without x
[16:48:06] jhass: ^ good one
[16:48:25] braincrash: has joined #ruby
[16:48:26] jhass: I didn't see bundler in the context of the question
[16:48:34] jhass: --without is indeed preferable
[16:48:34] mooru: has joined #ruby
[16:49:04] jhass: or if not needing it is actually the more common case, group :rpi, optional: true do; and do --with rpi on the pi
[16:49:28] nankyokusei: has joined #ruby
[16:50:11] Impaloo: has joined #ruby
[16:50:19] Impaloo: Hey, does anyone use ruby-switch(1) here?
[16:51:06] kareeoleez: jhass: and what about the methods that use this gem ?
[16:51:25] jhass: they should check defined?
[16:51:34] jhass: ?anyone Impaloo
[16:51:34] ruby[bot]: Impaloo: Just ask your question, if anyone has, is or can, they will respond.
[16:51:36] kareeoleez: jhass: for example <td><%= DhtSensor.read(4, 11).temperature %>*C</td> returns a uninitialized constant ActionView::CompiledTemplates::DhtSensor (obviously)
[16:51:55] jhass: defined?(DhtSensor) &&
[16:52:47] bencc: has left #ruby: ()
[16:52:55] kareeoleez: this is awesome
[16:53:01] kareeoleez: jhass: thank you.
[16:54:53] shevy: would defined?(DhtSensor) be equivalent to Object.const_defined?(:DhtSensor)
[16:55:09] banister: has joined #ruby
[16:55:50] pilne: has joined #ruby
[16:56:29] lazaro: has joined #ruby
[16:58:07] aegis3121: has joined #ruby
[16:58:12] lazaro: has joined #ruby
[16:58:18] am55: has joined #ruby
[16:58:52] jhass: shevy: in this case they have the same result, but no, defined? is actually a keyword
[16:59:07] jhass: http://devdocs.io/ruby~2.3/syntax/miscellaneous_rdoc#label-defined-3F
[16:59:15] wrkrcoop: has joined #ruby
[17:01:33] darkxploit: has joined #ruby
[17:02:03] KCmetro: has joined #ruby
[17:02:19] tribals: has joined #ruby
[17:02:45] wrkrcoop: has joined #ruby
[17:03:39] Guest38_: has joined #ruby
[17:04:12] musl: has joined #ruby
[17:04:58] tomchapin: has joined #ruby
[17:05:02] Xiti: has joined #ruby
[17:05:09] Uranio-235: has joined #ruby
[17:05:58] braincrash: has joined #ruby
[17:07:49] shinnya: has joined #ruby
[17:08:26] tribals: consider this: https://gist.github.com/tribals/32c82a21a7ad5f94a688236637db7617 it doesn't work. my attempt is to yield each parsed number for each line, but i don't understand how to do that. can i yield form block?
[17:08:31] Impaloo: has left #ruby: ()
[17:09:07] ljarvis: "it doesn't work"
[17:10:38] mistermocha: has joined #ruby
[17:10:56] ljarvis: ok thanks for the info, I'll just hop onto the guessing train, choo choo
[17:11:07] ramfjord: has joined #ruby
[17:12:59] ljarvis: tribals: but seriously.. why doesn't it work? it's not really an optimal description of your issue
[17:13:08] smathy: has joined #ruby
[17:14:16] ljarvis: https://eval.in/592234
[17:14:34] ljarvis: looks like it works to me
[17:15:02] mikecmpbll: has joined #ruby
[17:15:38] Vingador_: has joined #ruby
[17:16:08] tribals: ljarvis: it doesn't work because it is piece of shit, not code. what i asking for is how to implement a parser that supports enumeration on it (`#each`, `#map`, etc), and one line can contain multiple parsed values
[17:17:07] gettalong: has joined #ruby
[17:17:49] mistermocha: has joined #ruby
[17:18:00] apeiros: tribals: if it doesn't work, then you should fix it.
[17:18:15] ljarvis: tribals: you probably want to check out the Enumerable module
[17:18:18] apeiros: if "you should fix it" sounds like an unspecific useless piece of information, then that's because "it doesn't work" is too
[17:18:21] ljarvis: that said, there's a bug in your implementation
[17:18:35] tribals: apieros: i not asking you to fix it
[17:18:36] ljarvis: but I dont think you'll notice it until you start using enumerable methods
[17:18:45] apeiros: ?tabnick tribals
[17:18:45] ruby[bot]: tribals: pro-tip - use tab completion for nicks. avoids typos in nicks.
[17:18:56] ddffg: has joined #ruby
[17:18:56] ljarvis: ahh good old apieros is back
[17:19:13] blaxter: has joined #ruby
[17:19:18] apeiros: "can I yield form[sic] block" - if you mean "can I yield within a block", then yes, you can.
[17:19:28] ljarvis: my example shows that anyway
[17:19:33] ljarvis: line 19 has a bug
[17:19:40] ljarvis: is a bug, rather
[17:19:49] ddffg: why do i get such error undefined method `beginning_of_day' for #<DateTime:0x00556b918a8570>
[17:19:49] ljarvis: or it's just silly
[17:19:52] ljarvis: the line is fine
[17:19:57] tomchapin: has joined #ruby
[17:20:00] ljarvis: ddffg: because you didn't require active support
[17:20:01] ddffg: ruby 2.3.0 and 2.3.1
[17:20:14] ljarvis: ddffg: it's an active support extension (monkey patch)
[17:20:21] Macaveli: has joined #ruby
[17:20:23] ljarvis: require "active_support/date" or something
[17:20:39] ddffg: what is alternaivity
[17:20:46] ljarvis: excuse me?
[17:20:51] apeiros: today's spelloday
[17:20:55] ljarvis: an alternative?
[17:21:05] tribals: apeiros: sorry for typo
[17:21:08] ljarvis: or something about being naive
[17:21:09] tribals: in your nick
[17:21:28] ljarvis: ddffg: well, you can just build a new date object and set the time to 0
[17:22:43] ljarvis: e.g. something like d = Date.today; DateTime.new(d.year, d.month, d.day, 0)
[17:22:48] ljarvis: >> d = Date.today; DateTime.new(d.year, d.month, d.day, 0)
[17:22:50] ruby[bot]: ljarvis: # => uninitialized constant Date ...check link for more (https://eval.in/592239)
[17:23:00] ljarvis: >> require "date"; d = Date.today; DateTime.new(d.year, d.month, d.day, 0)
[17:23:01] ruby[bot]: ljarvis: # => #<DateTime: 2016-06-20T00:00:00+00:00 ((2457560j,0s,0n),+0s,2299161j)> (https://eval.in/592240)
[17:23:58] adam12: tribals: Were you looking to do something like this? https://eval.in/private/26ba9a833bdd88
[17:24:42] Eiam: has joined #ruby
[17:25:01] rikkipitt: has joined #ruby
[17:25:05] tribals: adam12: yes! thanks!
[17:25:22] adam12: tribals: That actually might not work for you, and you might have to consider including Enumerable.
[17:25:40] adam12: I was thinking because it responded to each it would handle calls for `map`, etc, but I think I am mistaken.
[17:30:02] DTZUBDUB: has joined #ruby
[17:30:10] rcvalle: has joined #ruby
[17:32:50] schuuu: has joined #ruby
[17:33:19] Moosashi: has joined #ruby
[17:33:27] mistermo_: has joined #ruby
[17:34:36] firstdayonthejob: has joined #ruby
[17:35:08] eGGshke: has joined #ruby
[17:40:26] giz|work: has joined #ruby
[17:41:33] Coldblackice: has joined #ruby
[17:42:48] jetpackjoe: has joined #ruby
[17:43:39] replay: has joined #ruby
[17:44:11] wrkrcoop: has joined #ruby
[17:46:06] dionysus69: has joined #ruby
[17:46:10] jenrzzz: has joined #ruby
[17:46:10] jenrzzz: has joined #ruby
[17:46:42] coolboy: has joined #ruby
[17:47:30] tAn: has joined #ruby
[17:48:07] palms: has joined #ruby
[17:48:52] marahin: Having a hash: http://hastebin.com/xunadafula.coffee - how can I search if any of the values return nil?
[17:49:09] marahin: As in: how can I deep search hash to find out if there's a nil value in **any** place
[17:51:00] ruby[bot]: has joined #ruby
[17:51:00] ChanServ: +o ruby[bot]
[17:51:12] craigp: has joined #ruby
[17:51:51] coolboy: some_hash.any? { |d| d.nil? } ?
[17:52:07] xall: has joined #ruby
[17:53:01] last_staff: has joined #ruby
[17:53:14] spider-mario: has joined #ruby
[17:53:18] djbkd: has joined #ruby
[17:55:25] marahin: [18] pry(main)> a
[17:55:25] marahin: => {:a=>{:a1=>nil, :a2=>"c"}, :b=>{:b1=>2, :b2=>"test"}}
[17:55:25] marahin: [19] pry(main)> a.any?{ |d| d.nil? }
[17:55:40] marahin: it should return true, as a[:a][:a1] is nil.
[17:55:53] toretore: if you want any level you need to write a separate function which recurses the structure
[17:56:08] Moosashi: has joined #ruby
[17:56:26] coolboy: ahhh sorry, glossed over "deep"
[17:56:46] coolboy: In vacation mode.
[17:56:50] marahin: toretore, I see. What would be the good approach? What functions should I use?
[17:56:57] marahin: coolboy, haha no worries :)
[17:57:28] coolboy: recursion is good for nested traversal.
[17:59:15] blackmes1: has joined #ruby
[18:01:26] SilverKey: has joined #ruby
[18:02:30] bmurt: has joined #ruby
[18:03:06] ule: has joined #ruby
[18:05:03] nankyokusei: has joined #ruby
[18:06:21] coolboy: http://hastebin.com/uguvaselip.rb
[18:06:36] coolboy: warning: probably not the best way to do this.
[18:07:01] postmodern: has joined #ruby
[18:07:23] bluOxigen: has joined #ruby
[18:11:27] roamingdog: has joined #ruby
[18:11:38] ljarvis: marahin: if a value is an array, do you need to check the entire array?
[18:12:11] ljarvis: or are there nested hashes?
[18:12:33] ramfjord: has joined #ruby
[18:12:51] ljarvis: also do you need to check keys?
[18:14:26] Pumukel: has joined #ruby
[18:15:36] ule: has joined #ruby
[18:15:41] ChiefAlexander: has joined #ruby
[18:15:41] ocbtec: has joined #ruby
[18:15:56] tAn: has joined #ruby
[18:16:46] marahin: ljarvis, it's just a nested hash with unique symbols as keys
[18:18:33] ljarvis: marahin: do you care about speed?
[18:18:41] moonman: has joined #ruby
[18:19:21] marahin: ljarvis, look at the example hash - it's a hash of two nested hashes with two values each
[18:19:30] marahin: e.g. 4 elements
[18:19:37] ljarvis: marahin: yes I see
[18:19:46] marahin: I don't think there _could_ be an algorithm that would make it slow ;)
[18:19:58] ljarvis: >> {a: { b: nil, c: 1 }, b: { c: "2" } }.values.flat_map(&:values).any?(&:nil?)
[18:20:05] ruby[bot]: ljarvis: # => true (https://eval.in/592300)
[18:20:13] marahin: ljarvis, thank you!
[18:20:31] ljarvis: np, the performance comment was because this code wouldn't be good if the hash was huge
[18:20:34] evansbee: has joined #ruby
[18:20:49] ljarvis: (in which case you'd want a recursive method that would return at the first occurence of nil)
[18:21:50] nankyokusei: has joined #ruby
[18:22:08] ych: has joined #ruby
[18:23:16] ankhers: has joined #ruby
[18:23:33] ltd: has joined #ruby
[18:24:19] nerium: has joined #ruby
[18:24:28] jaguarmagenta: has joined #ruby
[18:27:26] palms: has joined #ruby
[18:28:14] rickmasta: has joined #ruby
[18:28:24] chip_: has joined #ruby
[18:29:22] Synthead: I'm stuck on some implementation with net-sftp concerning net-ssh: http://pastie.org/10884399
[18:29:32] Synthead: as line 3 reads: "If I comment this line out, the .loop hangs. If I don't, it works without issues."
[18:29:55] blackmes1: has joined #ruby
[18:30:04] Synthead: something with the sftp but makes the ssh.loop hang, but only when I call sftp first
[18:30:20] Synthead: is there a need to "reset" or "close" the sftp connection or something?
[18:30:28] emiltin: has joined #ruby
[18:30:32] jpterry: has joined #ruby
[18:30:37] Synthead: I'd really like to do this work without multiple connections
[18:30:42] aegis3121: has joined #ruby
[18:30:58] Synthead: oh, and the sftp but must happen before the command (synchronously, not async)
[18:31:32] adam12: Synthead: Not directly related, but have you tried scp instead?
[18:33:50] emiltin: has joined #ruby
[18:35:12] Synthead: adam12: no, but I'm open to the idea
[18:35:30] Synthead: I need to write a string to a file, but I could do that with StringIO.new(string)
[18:36:01] Synthead: yeah why not... I'll try it
[18:36:39] gfvcastro: has joined #ruby
[18:37:00] Synthead: adam12: can it piggyback off of the Net::SSH connection?
[18:38:20] blandflakes: has joined #ruby
[18:39:02] fenre: has joined #ruby
[18:39:30] blackmes1: has joined #ruby
[18:41:20] lalalaaa: Synthead: Did you see Lord of the synths just now?
[18:41:36] Synthead: lalalaaa: no, haha
[18:42:22] Synthead: omg, that's awesome
[18:42:35] Synthead: I'm at work but I'll watch the whole thing later XD
[18:43:06] lalalaaa: like that other swedish one couple of months back just as good
[18:43:12] adam12: Synthead: I believe so? `ssh.scp.upload!(local_path, remote_path)`
[18:43:25] the_drow: has joined #ruby
[18:43:28] Synthead: adam12: very interesting... I'll check it out!
[18:43:30] adam12: Synthead: I'm using a StringIO object for local path, so I am not sure if you need to pass an open file object, but you can check docs.
[18:43:52] Synthead: adam12: I'm ok with a StringIO object
[18:44:05] spiette: has joined #ruby
[18:44:08] Synthead: I think it's a lot less crufty than opening a file and doing a .puts anyway
[18:44:09] adam12: Synthead: Actually I backscrolled and saw that.
[18:44:42] Synthead: I am responding to my own text
[18:44:50] Synthead: man, I am just on three wheels today
[18:45:21] kareeole_: has joined #ruby
[18:46:24] jancel: has joined #ruby
[18:46:32] boogeyman: has joined #ruby
[18:46:43] moeabdol: has joined #ruby
[18:46:54] jenrzzz: has joined #ruby
[18:47:11] adam12: Synthead: I'm using this as well, which I probably stole from somewhere years ago. https://gist.github.com/04130922ba7e610dc7de3cfda2f807f7
[18:47:32] karmatr0n: has joined #ruby
[18:47:55] Synthead: adam12: yeah that's actually nearly verbatim to what I'm doing, hah
[18:48:12] Synthead: adam12: the scp bit piggybacked with the ssh connection worked with StringIO :)
[18:48:20] Synthead: I'm gonna see if it crashes the channel still
[18:48:25] adam12: I was tired of reproducing it for every command so it got abstracted.
[18:48:29] adam12: Cool! Good luck.
[18:48:33] Coldblackice: has joined #ruby
[18:49:01] Synthead: some guy made net-ssh-simple, but I looked at it and the syntax wasn't as nice as I wanted
[18:49:10] gusrub: has joined #ruby
[18:50:40] the_drow: has joined #ruby
[18:50:46] symm-: has joined #ruby
[18:50:48] blaxter: has joined #ruby
[18:54:07] edwinvdgraaf: has joined #ruby
[18:54:46] xall_: has joined #ruby
[18:55:32] the_drow: has joined #ruby
[18:55:34] ruby-lang367: has joined #ruby
[18:55:35] Synthead: adam12: works beautifully! thanks for the help!
[18:55:50] ruby-lang367: I need some help grabbing links
[18:55:52] adam12: Synthead: cheers :)
[18:56:08] symm-_: has joined #ruby
[18:56:22] wolffles: has joined #ruby
[18:56:59] mooru_: has joined #ruby
[18:57:45] ruby-lang367: Under Most admired 2015, go here: http://fortune.com/worlds-most-admired-companies/2015/
[18:57:51] ruby-lang367: can someone help me grab the links
[18:57:56] ruby-lang367: for all the companies
[18:58:22] mikecmpbll: has joined #ruby
[18:58:51] lupine: so, um. I like 3M
[18:58:56] lupine: the rest are a bit evil
[18:58:57] dikaio: has joined #ruby
[18:58:58] KCmetro: has joined #ruby
[18:59:26] palms: has joined #ruby
[18:59:45] nerium: Is there a gem that makes it possible to get a value from a hash using a query language? I.e ”key1.key2[2]” would result in {key1 => {key2 => [1,2,3]}} => 3
[19:00:01] smathy: ruby-lang367, the people here are more interested in teaching you how to improve your knowledge of ruby, rather than give you free solutions to your underlying problem.
[19:00:03] Synthead: ruby-lang367: you probably want to use rest-client and nokogiri
[19:00:21] Synthead: ruby-lang367: also, the company list is paginated, so you'll want to account for that
[19:00:22] smathy: nerium, the dig method.
[19:00:54] Synthead: ruby-lang367: in chrome/chromium, open the console, go to the network tab, refresh the page, then scroll the results to see what I mean
[19:00:55] smathy: (assuming 2.3)
[19:01:12] Synthead: it'll make ajax calls as you scroll with uris of 2/, 3/, 4/, etc
[19:01:35] jgt: has joined #ruby
[19:02:23] vuoto: has joined #ruby
[19:02:25] Synthead: also, I didn't look at the ajax data, but you might be able to just JSON.parse the payload from that instead of using nokogiri
[19:02:32] nerium: smathy: That will only work on non nested object, or am I missing something?
[19:03:21] the_drow: has joined #ruby
[19:03:30] Synthead: nerium: key1["key2"][2] ?
[19:03:43] Synthead: nerium: ["key1"]["key2"][2], rather?
[19:04:05] Synthead: oh I see what you're doing, nevermind
[19:04:16] nerium: Synthead: I was hoping for a query language :)
[19:04:22] norc: has joined #ruby
[19:04:39] Synthead: nerium: what's the use case?
[19:04:58] nerium: I’m trying to select a value from a deep nested hash
[19:05:14] Synthead: nerium: in a static or dynamic fashion?
[19:05:17] nerium: This is the key ”.context.dispatcher.stores.PageStore.pages./nrj/latlista.data[1].modules[2].content[0].title”
[19:05:27] nerium: (just to give you an idea)
[19:05:38] nerium: Synthead: Not sure what you mean
[19:06:14] Synthead: nerium: as in, is the code always going to be (i.e.) "x.y.z", or are you going to be taking user input for this or something?
[19:06:45] nerium: Synthead: Aha. Then it’s dynamic
[19:06:46] zeroDi: has joined #ruby
[19:07:25] Synthead: nerium: are you going to be using this query-esque language just for your own code, or is it going to be seen in the final product?
[19:08:02] the_drow: has joined #ruby
[19:08:12] nerium: Synthead: final
[19:08:15] adam12: nerium: You could likely build some sort of proxy or adapter that a) responded to method missing and b) overwrote/defined #[]
[19:08:21] Synthead: nerium: ah, ok
[19:08:29] adam12: nerium: I'm not sure I would do something like that tho?
[19:08:40] nerium: Why not? :)
[19:08:55] adam12: nerium: I think the tools Ruby provides for accessing nested hashes is good enough... :)
[19:08:59] Synthead: nerium: the reason why I'm asking these questions is because it sounds like a bit of code smell over here
[19:09:22] Synthead: it's custom, so others will not know how to look it up, use it, it would have to be maintained, there might be weird bugs, etc
[19:09:48] Synthead: and on the turn of things, it'll likely be slower than standard ruby, and provide limitations (what if the key must have a "." in it?)
[19:09:48] nerium: I need something that can be expressed on a single line and fail with a proper error message
[19:10:18] Synthead: I think you're better off using an Array of keys, then using a recursive function with .fetch to dig into the object a bit
[19:10:25] nerium: True. That’s why I’m asking for an already exiting language
[19:10:36] nerium: That already solved these problems
[19:10:59] banister: has joined #ruby
[19:11:04] dsimon: nerium: http://ruby-doc.org/core-2.3.0_preview1/Hash.html#method-i-dig
[19:11:09] dsimon: this was added to 2.3 and might help
[19:11:11] nerium: Or I can force the user to escape . and [] like most other languages does
[19:11:32] nerium: dsimon: Know about that one, thanks :)
[19:11:33] dsimon: you'll still have to split the key yourself
[19:11:34] Synthead: or dig! I didn't know about that one!
[19:11:37] Synthead: that's a cool method!
[19:11:44] dsimon: it is :-)
[19:12:00] toretore: nerium: are you sure you actually do need to expose this functionality to the user?
[19:12:04] dsimon: i think they put it in after adding &. because there wasn't a good way to use &. with the [] operator
[19:12:15] Synthead: 1% of my code got uglier today by learning dig :D
[19:12:21] crystal77: has joined #ruby
[19:12:50] nerium: toretore: No. It’s for internal code
[19:13:01] toretore: nerium: what's the context?
[19:13:07] the_drow: has joined #ruby
[19:13:47] banister: has joined #ruby
[19:14:10] thegunbuster: has joined #ruby
[19:14:11] thegunbuster: has joined #ruby
[19:14:17] toretore: nerium: nerium why does it have to be a query? is it to be entered by a user/admin and the stored somewhere before it's used?
[19:14:33] nerium: Would like to access JSON/Hash keys like css queries to print better error messages and reduce the amount of code needed
[19:14:42] craigp_: has joined #ruby
[19:15:11] toretore: so this is something that never leaves your code?
[19:15:21] adam12: nerium: I encourage you to reconsider but I whipped up something quick and likely not optimal. https://gist.github.com/adam12/a722172021778fcc3055abb366624037
[19:15:45] nerium: Then the parser can use it to print propper messages. I.e ”You passed a.b[1].c but a.b is not an array"
[19:16:15] djbkd: has joined #ruby
[19:17:06] the_drow_: has joined #ruby
[19:17:07] toretore: nerium: still missing a lot of context here to be able to see the big picture
[19:17:28] nerium: I might have been a bit unclear. I can something like this my self but was hoping for something already exiting so that I dont have to spend time testing, documenting and fixing small bugs in the code for the next weeks
[19:17:53] nerium: toretore: I can show you some example usage
[19:17:56] adam12: nerium: My implementation is 19 lines, unoptimized. I'm not sure I'd want another dependency in place of it.
[19:18:04] thegunbuster: Would anyone be interested to contribute to a ruby stats library? (https://github.com/vaibhav-y/statistical)
[19:18:17] toretore: nerium: what i'm getting at is that it's complicated and there is nothing afaik that will integrate cleanly and easily with your case
[19:18:28] kappy: has joined #ruby
[19:18:30] thegunbuster: If this isn't allowed here, let me know I won't do that again
[19:19:37] globalall0c: has joined #ruby
[19:20:09] juanfra: has joined #ruby
[19:21:02] globalall0c: ruby vs python
[19:21:21] serbalgi: has joined #ruby
[19:22:12] globalall0c: why is python recommended as the ideal language for beginners? instead of ruby
[19:22:34] nerium: ACTION toretore: Here’s in an example. #get itterates the first object using the second argument split by ”.” 
[19:22:35] nerium: https://github.com/radiofy/station/blob/master/lib/stations/p4_norge.rb
[19:22:48] nerium: ACTION I would like to do 
[19:23:18] nerium: get(data, ”ProgramInstance.Elements[-1].TrackTitle”
[19:23:31] the_drow: has joined #ruby
[19:23:33] nerium: Without having to implement my own language (like I’ve now)
[19:23:41] nerium: or is there a better way?
[19:24:21] thegunbuster: globalall0c various factors. But the biggest I recall is that ruby caught on in popularity later.
[19:24:56] thegunbuster: There's also performance and closeness to psuedo code, along with standards enforcement (which python does better)
[19:25:04] nofxx: I would recommend ruby first, way more clear and well thought globalall0c
[19:25:08] thegunbuster: by standards enforcement I mean the PEP guidelines
[19:25:18] nerium: adam12: The problem is that you code isn’t tested or documented – something that takes quite sometime
[19:25:40] nerium: I’m not saying it’s bad :)
[19:25:41] globalall0c: nofxx, i program in c and asm
[19:25:50] globalall0c: my gf, knew to cs, wants to learn ruby
[19:26:09] globalall0c: clearly, c && asm != ruby
[19:26:09] thegunbuster: What do you eventually want to do with ruby?
[19:26:14] lupine: I'd suggest learning scheme first
[19:26:16] lupine: HtDP is god
[19:26:33] globalall0c: thegunbuster, nothing. i want to help her learn
[19:26:36] thegunbuster: Is it just a language or are you interested in a specific application, like scientific computing, web-dev, simulations etc
[19:26:39] nofxx: globalall0c, you'll have fun teaching her. Also you'll know both sides of all of this
[19:26:44] albedoa: has joined #ruby
[19:26:53] nofxx: globalall0c, asm raw it can gets, ruby the high level smarter it gets
[19:27:05] globalall0c: nofxx, i also do .net
[19:27:06] toretore: nerium: there are json query languages like http://goessner.net/articles/JsonPath/ but i probably wouldn't add such a dependency for internal use
[19:27:13] globalall0c: im insanely biased to low level stuff
[19:27:19] nerium: toretore: Why?
[19:27:20] freerobby: has joined #ruby
[19:27:25] globalall0c: but my gf, being smarter than me, wanted to do high level
[19:27:36] the_drow: has joined #ruby
[19:27:44] toretore: nerium: i don't like introducing dependencies when i don't have to
[19:27:50] nofxx: globalall0c, haha...yeah, I'm ok with ~200 programming an AVR in C... asm NO PLEASE
[19:27:55] roamingdog: has joined #ruby
[19:27:59] nofxx: ~200~500 lines of C*
[19:28:04] thegunbuster: ask her again, if she wants to apply the language somewhere specific
[19:28:09] toretore: nerium: the threshold for added value / cost for me is quite high
[19:28:14] thegunbuster: ASM is a nightmare to navigate :(
[19:28:33] nofxx: globalall0c, I remember skipping 8085 classes to drink beer. Don't regret ;)
[19:28:35] nerium: toretore: Not having to write, test, document, maintain any piece of code is a win (for me)
[19:28:38] thegunbuster: otherwise, a good resource for ruby is the ruby-koans project
[19:28:42] lupine: learning a language is muc h less important than learning to program
[19:28:53] lupine: you can do that in any language, scheme happens to have good resources
[19:29:00] toretore: nerium: dependencies hide complexity that you don't control
[19:29:14] nofxx: globalall0c, check chris pine learn to program, great and online
[19:29:43] nerium: toretore: True. Read an aricle about that a few month ago
[19:29:50] globalall0c: nofxx, im trying to stray away from anything online. i learned from books and hands on, i think online material doesnt teach correctly IMO
[19:29:56] nerium: I gues that’s something you need to take into considuration
[19:29:58] toretore: nerium: the alternative is to access your data only using the methods provided on built-in data structures, which is what i would do until it became close to unbearable
[19:29:59] dikaio: has joined #ruby
[19:30:05] smathy: nerium, you caught up now re dig?
[19:30:07] thegunbuster: globalall0c, I learnt with these: http://rubykoans.com/ (Great after an introductory book)
[19:30:31] globalall0c: thegunbuster, she thinks it clear-er than other languages and she likes the rapid development behind it
[19:30:32] nerium: toretore: Not sure I understand what you mean
[19:30:39] nerium: smathy: What?
[19:31:01] nofxx: globalall0c, that's an ASM concept =D drop it. high lvl langs changes monthly
[19:31:04] smathy: nerium, you're clear? I just got back, saw you asked me something about nesting, but you seem to be ok now?
[19:31:29] nofxx: at least their libs... reuse of code... we call 'gems'
[19:31:31] SCHAAP137: has joined #ruby
[19:31:42] norc: globalall0c, no book teaches correctly. Only practice does.
[19:31:51] thegunbuster: I agree about video series, the best way to learn the language is to use it! & maybe read about the caveats
[19:32:02] nofxx: yup... and up to date material saves times
[19:32:04] nerium: smathy: Sort of. Do you know any json query language simular to css selectors for ruby?
[19:32:17] globalall0c: norc, i agree, but when i started ages ago i would read books cover to cover
[19:32:35] globalall0c: it helped me improve.. A LOT
[19:32:49] norc: globalall0c, actually writing code and participating on github would have helped you improve... MORE.
[19:32:51] thegunbuster: But then, I got my hands on turbo-c++
[19:33:06] norc: globalall0c, Im not saying that books are bad, but actual real world practice is better.
[19:33:10] smathy: nerium, https://github.com/joshbuddy/jsonpath
[19:33:14] norc: You can have a book along side if you chose though.
[19:33:22] the_drow: has joined #ruby
[19:33:25] globalall0c: norc, it all depends on the person. i do malware dev and offensive security
[19:33:28] mattwashere: has joined #ruby
[19:33:29] smathy: More xpath than css selectors, but might suit your goals.
[19:33:44] djbkd: has joined #ruby
[19:33:49] norc: globalall0c, I find that offensive.
[19:33:50] mtkd: has joined #ruby
[19:33:54] globalall0c: but, again, it all depends. my idea was always a project or an established goal
[19:34:05] globalall0c: but i did it independently
[19:34:10] mshowman: has joined #ruby
[19:34:39] thegunbuster: Lets all agree that different people learn differently?
[19:35:11] nerium: smathy: *reading* thanks!
[19:36:02] thegunbuster: So would anyone be able to comment / or some tips for this: https://github.com/vaibhav-y/statistical ?
[19:36:20] smathy: It's a github repo.
[19:36:22] thegunbuster: It's a statistics library I'm working on
[19:36:35] thegunbuster: Exactly, I was hoping to get a few more eyes to look at it
[19:36:38] norc: globalall0c, well as I said. It's not a bad strategy, but books do not give you experience. They just give you theory.
[19:36:48] smathy: thegunbuster, that was my comment.
[19:37:06] thegunbuster: smathy, I am regretting my lack of specificity
[19:37:29] mooru: has joined #ruby
[19:38:23] pawnbox: has joined #ruby
[19:38:54] smathy: thegunbuster, "Changes:" is a bad first line for a git commit.
[19:39:48] thegunbuster: duly noted. I'll try with a shorter summary
[19:40:25] SilverKey: has joined #ruby
[19:40:42] toretore: git commit -m"some stuff"
[19:40:56] cdg: has joined #ruby
[19:41:14] adam12: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[19:41:38] mikecmpbll: has joined #ruby
[19:41:59] thegunbuster: toretore, whoa where?
[19:42:20] smathy: He was just giving more examples of bad first lines :)
[19:42:32] toretore: thegunbuster: in all of my repos
[19:42:35] smathy: My personal favorite `git commit -mWIP` :)
[19:42:47] norc: smathy, I use compact git commit messages at work all the time
[19:42:51] norc: "stuff unfucked"
[19:42:55] norc: It's quite handy.
[19:42:55] toretore: git commit -m"use git show dumbass"
[19:43:09] mattwashere: has joined #ruby
[19:43:10] thegunbuster: I like spam committing and then I squash them all
[19:43:18] adam12: thegunbuster: I looked over it. Looks good, tho I don't know shit about stats. I noticed you use explicit returns in some places where they aren't needed. Assuming this is for a certain styleguide?
[19:43:28] DTZUBDUB: has joined #ruby
[19:43:38] norc: squashing is if your colleagues cant handle profanity, in which case I recommend a better job.
[19:43:54] smathy: git ci -m"squash this"
[19:44:20] thegunbuster: adam12, Yes it's just a style preference, I come from C so I find it easier to have methods end with a return
[19:44:33] thegunbuster: Had to fight rubocop for that one
[19:44:39] adam12: Hah. Yep.
[19:44:43] elomatreb: squashing also creates gigantic diffs. Hard to scan quickly
[19:44:44] norc: thegunbuster, do you also declare the return type for every method?
[19:44:48] kirun: has joined #ruby
[19:45:02] thegunbuster: I try to as much as possible in the yardoc comments
[19:45:04] norc: thegunbuster, honestly rubocop is misused for the most part.
[19:45:20] norc: thegunbuster, the only thing I use it for is converting the random "" to '' strings.
[19:45:35] thegunbuster: and trimming trailing WS :D
[19:45:52] norc: thegunbuster, both vi and git will cry if I have trailing WS.
[19:46:06] thegunbuster: I'm coding from c9.io
[19:46:18] thegunbuster: my laptop is finally potato
[19:46:28] marahin: How can I define a method, that would react to this: a = Model.new; a('argument')?
[19:47:07] adam12: marahin: use case
[19:47:28] thegunbuster: a is a Model object. You pass data to a method
[19:47:29] moeabdol: has joined #ruby
[19:47:41] jenrzzz: has joined #ruby
[19:47:41] jenrzzz: has joined #ruby
[19:47:44] thegunbuster: unless you define the () method for a
[19:47:51] KCmetro: has joined #ruby
[19:47:53] marahin: adam12, I just wanted to learn really, if that's possible or not :)
[19:47:58] thegunbuster: which you can't IIRC (restricted by ruby)
[19:48:00] elomatreb: Are you coming from PHP? __invoke() was a mistake
[19:48:05] marahin: thegunbuster, and defining such method is impossible, yes?
[19:48:09] marahin: elomatreb, not at all :P
[19:48:23] marahin: thegunbuster, that's what I wanted to know
[19:48:24] thegunbuster: you can try def self.[](*args); # something; end
[19:48:25] marahin: thank you guys.
[19:48:45] thegunbuster: square brackets are the only exception to this rule
[19:48:47] adam12: marahin: Some people will (ab)use [] to achieve similiar results.
[19:49:03] adam12: Sequel is a great example of this, which is done well.
[19:49:11] Mon_Ouie: You can also do foo.(argument) which is a special syntax to call the #call method
[19:49:36] crank1988: has joined #ruby
[19:49:38] thegunbuster: Ha, didn't know that #call can be done that way too
[19:50:57] thegunbuster: adam12, anything else you'd like to add? Like specific features that you expect from a stats library?
[19:51:17] adam12: thegunbuster: tbh, not super familiar with stats, so I'd probably defer any answer.
[19:51:26] thegunbuster: All I planned right now is RNGs, Distributions and a Hypothesis (A-B testing) module
[19:51:37] karmatr0n: has joined #ruby
[19:52:13] Spami: has joined #ruby
[19:53:33] thegunbuster: well guys, if you do get any ideas feel free to open an issue at https://github.com/vaibhav-y/statistical
[19:53:44] thegunbuster: I'll head to sleep, G'night!
[19:53:57] ur5us: has joined #ruby
[19:57:10] KCmetro: has joined #ruby
[19:57:52] moei: has joined #ruby
[19:58:28] hahuang62: has joined #ruby
[19:58:29] codecop: has joined #ruby
[19:58:42] joonty: has joined #ruby
[20:00:20] mattwashere: has joined #ruby
[20:00:46] tAn: has joined #ruby
[20:02:08] madgen: has joined #ruby
[20:02:39] rkazak: has joined #ruby
[20:06:55] mynameisbrian: has joined #ruby
[20:07:20] mynameisbrian: is it uncommon to have an instance attribute as an array?
[20:07:43] skade: has joined #ruby
[20:07:44] mynameisbrian: I wanted to do: obj.prop = 'hello' and then 'hello' gets pushed onto the array
[20:07:48] smathy: Only when something else would make more sense.
[20:08:12] mynameisbrian: what about that setter syntax? Or is a method to add onto the array more common?
[20:08:19] yfeldblum: has joined #ruby
[20:08:28] mynameisbrian: because then there would be no way to delete, and so I would have to provide a method for this
[20:08:44] smathy: Overriding `prop=` to mean `prop <<` is a terrible API cludge.
[20:09:18] mshowman_: has joined #ruby
[20:09:23] mynameisbrian: I have a list of folders I want to generate, so I'm just trying to think of the best way to store the folder names
[20:10:02] ramfjord: has joined #ruby
[20:10:41] mattwashere: has joined #ruby
[20:11:16] troulouliou_dev: has joined #ruby
[20:11:22] YaknotiS: has joined #ruby
[20:13:21] spudowiar: has joined #ruby
[20:14:08] Wixy: has joined #ruby
[20:14:39] johnmilton: has joined #ruby
[20:15:18] gfvcastro: has joined #ruby
[20:16:17] dikaio: has joined #ruby
[20:16:41] yardenbar: has joined #ruby
[20:16:47] SilverKey: has joined #ruby
[20:17:29] Tachikomas: has joined #ruby
[20:17:30] ebbflowgo: has joined #ruby
[20:17:44] albedoa: has joined #ruby
[20:17:57] mattwashere: has joined #ruby
[20:19:01] moeabdol: has joined #ruby
[20:19:10] roamingdog: has joined #ruby
[20:19:42] cdg: has joined #ruby
[20:20:31] roamingdog: has joined #ruby
[20:22:17] imperator: jhass, thanks
[20:23:02] Macaveli: has joined #ruby
[20:23:12] ruby[bot]: has joined #ruby
[20:23:12] ChanServ: +o ruby[bot]
[20:24:14] roamingd_: has joined #ruby
[20:25:15] jaguarmagenta: has joined #ruby
[20:27:03] mistermo_: has joined #ruby
[20:27:24] roamingdog: has joined #ruby
[20:27:35] blackgoat: has joined #ruby
[20:28:15] joonty: has joined #ruby
[20:29:49] Moosashi: has joined #ruby
[20:32:29] bmurt: has joined #ruby
[20:35:15] craigp_: has joined #ruby
[20:35:27] dionysus69: has joined #ruby
[20:37:55] spiette: has joined #ruby
[20:38:30] blaxter: has joined #ruby
[20:39:04] RegulationD: has joined #ruby
[20:40:10] rickmasta: has joined #ruby
[20:41:28] evansbee: has joined #ruby
[20:43:36] diegoaguilar: has joined #ruby
[20:44:52] ornerymoose: has joined #ruby
[20:47:09] snebel: has joined #ruby
[20:47:18] jgt: has joined #ruby
[20:47:59] albedoa: [['a', 1], ['b', 2], ['c', 3]] <— how do i isolate the first elements (['a', 'b', 'c'] or 'abc' for instance)?
[20:48:25] jenrzzz: has joined #ruby
[20:49:14] ornerymoose: has joined #ruby
[20:50:07] snebel: Hi, may be a silly question.. anyway I'm looking for a mechanism to checkout some ruby version and gemfile and have rvm taking that config by default
[20:50:22] snebel: I'm playing right now with .ruby-version and .ruby-gemset
[20:50:25] snebel: but is not working
[20:50:38] blackgoat: has joined #ruby
[20:50:40] snebel: just created both files in an empty folder..
[20:50:54] snebel: i do ruby --version and nothing the default version is shown..
[20:52:02] snebel: instead of the one that is specifiec on the ruby-version file
[20:53:26] Mon_Ouie: albedoa: map(&:first)
[20:54:22] tobiasvl: was just going to suggest the same but with collect
[20:54:23] albedoa: Mon_Ouie thank you
[20:55:37] ecksit: has joined #ruby
[20:55:40] Moosashi: has joined #ruby
[20:55:41] minimalism: has joined #ruby
[20:56:44] johnmilton: has joined #ruby
[20:57:51] solars: has joined #ruby
[20:59:50] beneggett: has joined #ruby
[21:00:52] ChiefAlexander: has joined #ruby
[21:03:46] albedoa: Mon_Ouie is there a way to use the & operator for procs with more than one argument, such as: sort_by { |k, v| v }
[21:04:03] BrianJ: has joined #ruby
[21:05:05] yfeldblum: has joined #ruby
[21:06:25] norc: albedoa, you could write your own method on Symbol that implements it.
[21:06:51] jord-n: has joined #ruby
[21:07:35] albedoa: sort_by(&:last) works
[21:07:58] scorphus: how do I expect(an_element) to be_included_in an_array?
[21:08:10] beneggett: has joined #ruby
[21:08:21] norc: albedoa, https://eval.in/592337
[21:08:23] norc: example code included.
[21:08:36] albedoa: sweet thanks
[21:08:59] BrianJ: has joined #ruby
[21:09:13] Mon_Ouie: albedoa: That proc actually gets called with only one argument, which happens to be an array. That |k, v| syntax, which makes it look like there are two arguments, extracts the first and second element from the array.
[21:09:28] norc: scorphus, expect(ary).to include(1) ?
[21:09:43] mwlang: has joined #ruby
[21:09:44] norc: scorphus, note that it works on any object that responds to #include?
[21:09:50] scorphus: quite that, norc, but the other way around
[21:09:54] albedoa: Mon_Ouie gotcha, thanks. now i understand why my solution worked :D
[21:10:04] norc: scorphus, what do you mean?
[21:10:38] scorphus: so it should read expect([opt1, opt2, opt3) to include testing_method("test_string")
[21:11:03] scorphus: I mean, testing_method is the one method I'm writing this test for
[21:11:22] scorphus: s/opt3/opt3]/ sorry
[21:11:46] norc: scorphus, you can simply use enumerable
[21:11:58] norc: scorphus, mmm
[21:12:27] norc: scorphus, you dont have to put the subject into the expect()
[21:12:56] scorphus: expected = [this_one, that_one, or_another]
[21:13:48] norc: scorphus, rspec does not have such a matcher built in that I am aware of
[21:13:51] scorphus: ACTION goes looking for enumerable
[21:14:31] norc: scorphus, how do opt1, opt2 and opt3 relate to testing_method ?
[21:14:56] scorphus: they are possible return values
[21:15:22] scorphus: either of them are acceptable returns
[21:15:35] norc: scorphus, then test against the one you expect the method to return.
[21:16:01] norc: Given some input the method should behave predictably. If there is a random component, use seeds and mocks to enforce it.
[21:16:20] norc: Otherwise you have a case where a test might sometimes fail depending on what it returns.
[21:17:22] scorphus: got what you mean, norc
[21:17:38] FooMunki: has joined #ruby
[21:18:07] wrkrcoop: has joined #ruby
[21:19:06] ICantCook: has joined #ruby
[21:19:09] Ranoppinsky: has joined #ruby
[21:19:30] dikaio: has joined #ruby
[21:19:36] Rodya_: has joined #ruby
[21:21:12] danostrowski: has joined #ruby
[21:21:53] chris2: has joined #ruby
[21:24:35] BrianJ: has joined #ruby
[21:24:40] karmatr0n: has joined #ruby
[21:24:52] mjal: has joined #ruby
[21:26:12] ornerymoose: has joined #ruby
[21:27:11] jgt: has joined #ruby
[21:27:49] wrkrcoop: what is the point of rack?
[21:28:01] chris2: total waste of time ;)
[21:28:27] norc: wrkrcoop, play around with rack middleswares to find out whats so nice about it.
[21:28:38] wrkrcoop: norc: so is it just middleware?
[21:28:54] norc: wrkrcoop, well rack itself is just an interface.
[21:28:54] lupine: it's a repeated pattern for a reason
[21:29:00] wrkrcoop: does rails use rack?
[21:29:07] lupine: since 2.3
[21:29:08] norc: wrkrcoop, yes. and so does sinatra.
[21:29:11] lupine: bloody stupid rails
[21:29:13] wrkrcoop: norc: interesting
[21:29:26] lupine: (I had a rack organiser application. needless to say, a new toplevel Rack constant was not welcome)
[21:29:51] lupine: arrogating new toplevel names should be a major, not minor, version change
[21:31:17] wrkrcoop: what is the value of rake? why not just create a method that runs the code that would be in a rake task?
[21:31:48] adaedra: you're taking your rails gemfile line by line and asking the value of each line?
[21:32:01] lupine: rake can always be replaced with make
[21:32:04] lupine: and arguably should be
[21:32:49] adaedra: well, except if you need, you know, ruby.
[21:32:53] lupine: ACTION got to cope with a C project with a file-rules-based rakefile for building it once
[21:33:15] lupine: make can always shell out to a ruby script in the very rare occasion where you might actually need ruby
[21:33:18] lupine: which is ~0% of the time
[21:33:33] adaedra: of course, because your use case is our use case.
[21:33:43] lupine: preference != requirement
[21:33:48] lupine: (I'm trolling a bit, I don't actually like make that much)
[21:34:36] beneggett: has joined #ruby
[21:35:06] norc: wrkrcoop, the best way to recognize the value of a particular part is to interact with it enough until you get a feeling for it.
[21:35:21] wrkrcoop: norc: why can’t u just tell me the value
[21:35:30] norc: wrkrcoop, because no matter what I tell you its gonna be biased.
[21:35:35] wrkrcoop: norc: i see
[21:35:43] norc: And you won't know any better other than to quote someone who said something on some IRC channel
[21:35:47] mikecmpbll: has joined #ruby
[21:35:48] norc: who may or may not be a complete dork.
[21:36:28] skweek: has joined #ruby
[21:37:03] oryman: has joined #ruby
[21:38:06] ornerymoose: has joined #ruby
[21:38:30] symm-: has joined #ruby
[21:39:01] moeabdol: has joined #ruby
[21:39:05] ledestin: has joined #ruby
[21:39:49] Moosashi: has joined #ruby
[21:41:48] GodFather: has joined #ruby
[21:41:49] roamingdog: has joined #ruby
[21:42:38] banister: has joined #ruby
[21:44:16] d0nn1e: has joined #ruby
[21:45:57] oryman: has joined #ruby
[21:46:40] Rodya_: has joined #ruby
[21:49:11] gettalong: has left #ruby: ()
[21:49:11] jenrzzz: has joined #ruby
[21:49:12] jenrzzz: has joined #ruby
[21:51:08] bkxd: has joined #ruby
[21:52:20] jooni: has joined #ruby
[21:52:35] Moosashi: has joined #ruby
[21:53:23] SilverKey: has joined #ruby
[21:53:47] jord-n: has joined #ruby
[21:55:00] albedoa: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[21:55:01] ChiefAlexander: has joined #ruby
[21:57:27] jackjackdripper: has joined #ruby
[21:57:34] ruby-lang147: has joined #ruby
[22:03:40] Masstodon: has joined #ruby
[22:04:19] moeabdol: has joined #ruby
[22:07:47] Masstodon: has joined #ruby
[22:09:55] Brian: has joined #ruby
[22:09:56] danostrowski: has joined #ruby
[22:11:48] aeterne: has joined #ruby
[22:12:02] febuiles: has joined #ruby
[22:12:12] agit0: has joined #ruby
[22:16:27] nankyokusei: has joined #ruby
[22:17:51] CJKinni`: has joined #ruby
[22:18:10] mattwashere: has joined #ruby
[22:21:03] smathy: has joined #ruby
[22:22:29] BugBlatter: has joined #ruby
[22:24:40] pontiki: has joined #ruby
[22:24:42] lalalaaa: has joined #ruby
[22:26:01] jaguarmagenta: has joined #ruby
[22:32:26] jei2: has joined #ruby
[22:33:11] jhack: has joined #ruby
[22:33:38] snath: has joined #ruby
[22:34:08] Dimik: has joined #ruby
[22:35:28] zenlot6: has joined #ruby
[22:39:08] wixad_: has joined #ruby
[22:40:48] wixad_: when is it good to use getoptlong and optionsparser?
[22:41:23] jhass: for the cases where you don't want to install slop, obviously
[22:42:56] wixad_: does that mean both have the same functionality?
[22:42:57] gfvcastro: has joined #ruby
[22:43:15] SilverKey: has joined #ruby
[22:43:58] programmerq: has joined #ruby
[22:43:59] GodFather: has joined #ruby
[22:44:15] jackjackdripper: has joined #ruby
[22:44:21] wsewolod: has joined #ruby
[22:44:48] Sammichmaker: has joined #ruby
[22:45:16] evansbee: has joined #ruby
[22:45:51] roamingdog: has joined #ruby
[22:49:11] skweek: has joined #ruby
[22:49:58] jenrzzz: has joined #ruby
[22:51:56] sarlalian: has joined #ruby
[22:52:11] febuiles: has joined #ruby
[22:57:59] boogeyman: has joined #ruby
[22:59:09] sdwrage: has joined #ruby
[22:59:49] zacts: has joined #ruby
[23:00:12] ornerymoose: has joined #ruby
[23:00:41] smathy: wixad_, read the opening paragraph: http://ruby-doc.org/stdlib-2.3.1/libdoc/optparse/rdoc/OptionParser.html
[23:02:49] SilverKey: has joined #ruby
[23:04:36] tomchapin: has joined #ruby
[23:04:40] mtkd: has joined #ruby
[23:04:49] danostrowski: has joined #ruby
[23:06:11] zacts: hello rubyists
[23:06:27] amclain: has joined #ruby
[23:07:28] mikecmpbll: has joined #ruby
[23:07:53] rickmasta: has joined #ruby
[23:08:46] SCHAAP137: has joined #ruby
[23:08:53] SCHAAP137: has joined #ruby
[23:10:47] Rodya_: has joined #ruby
[23:11:25] jhass: hello zacts
[23:12:43] Moosashi: has joined #ruby
[23:13:10] jackjackdripper1: has joined #ruby
[23:13:36] jackjackdripper2: has joined #ruby
[23:13:39] jackjackdripper3: has joined #ruby
[23:14:40] tomchapin: has joined #ruby
[23:14:47] Masstodon: has left #ruby: ()
[23:15:16] AcidCrash0x00: has joined #ruby
[23:15:28] zacts: jhass are you a contributor to diaspora?
[23:15:42] zacts: I saw your nick in a commit I think, I'm wanting to learn more about the project
[23:15:50] zacts: is there a good channel to chat about it?
[23:16:02] jhass: well, #diaspora ;)
[23:16:53] rickmasta: has joined #ruby
[23:18:02] Moosashi: has joined #ruby
[23:18:24] diegoaguilar: has joined #ruby
[23:19:29] larsss: has joined #ruby
[23:19:43] zacts: jhass: heh, indeed. I guess I meant for a development chat. sorry. :-D
[23:19:51] jackjackdripper: has joined #ruby
[23:19:52] replay: has joined #ruby
[23:20:48] rickmasta: has joined #ruby
[23:21:48] tmi1: has joined #ruby
[23:23:00] wixad_: thx smathy
[23:24:36] toblogan: has joined #ruby
[23:26:19] Vile`: has joined #ruby
[23:27:02] mistermo_: has joined #ruby
[23:27:21] toblogan: has joined #ruby
[23:28:20] toblogan: has joined #ruby
[23:28:20] SilverKey: has joined #ruby
[23:28:54] toblogan: has joined #ruby
[23:29:31] toblogan: has joined #ruby
[23:30:52] lightt: has joined #ruby
[23:31:31] KCmetro: has joined #ruby
[23:31:58] ICantCook: has joined #ruby
[23:32:03] arlek: has joined #ruby
[23:32:16] edwardly: has joined #ruby
[23:32:16] edwardly: has joined #ruby
[23:33:44] jetpackjoe: has joined #ruby
[23:34:32] koooge: has joined #ruby
[23:36:30] toblogan: has joined #ruby
[23:42:23] Moosashi: has joined #ruby
[23:43:36] cbyrda: has joined #ruby
[23:43:40] agentmeerkat: has joined #ruby
[23:45:09] Xiti: has joined #ruby
[23:47:39] rkazak: has joined #ruby
[23:47:42] ruby-lang147: is the michael hartl book good? I need to learn ruby...already know python, c, etc..
[23:51:20] banister: has joined #ruby
[23:55:36] xybre: That's a Rails book, ruby-lang147.
[23:57:10] dikaio: has joined #ruby