« Back to channel list

#ruby - 14 June 2018

« Back 1 day Forward 1 day »
[00:01:48] shinnya: has joined #ruby
[00:04:23] sytherax: has joined #ruby
[00:09:37] ciscam: has joined #ruby
[00:16:07] orbyt_: has joined #ruby
[00:16:53] cagomez: has joined #ruby
[00:17:47] zenspider: the main confusion comes from `=` being in between `&&` and `and`.
[00:18:06] zenspider: >> a = :b and :c
[00:18:07] ruby[bot]: zenspider: # => :c (https://eval.in/1020957)
[00:18:13] zenspider: >> a = :b and :c ; a
[00:18:14] ruby[bot]: zenspider: # => :b (https://eval.in/1020958)
[00:24:10] dendazen: has joined #ruby
[00:25:06] BlopMonster: has joined #ruby
[00:26:41] roamingdog: has joined #ruby
[00:27:31] roamingdog: has joined #ruby
[00:28:16] roamingdog: has joined #ruby
[00:29:13] roamingdog: has joined #ruby
[00:29:56] roamingdog: has joined #ruby
[00:30:32] duderonomy: has joined #ruby
[00:30:41] roamingdog: has joined #ruby
[00:31:32] roamingdog: has joined #ruby
[00:32:17] roamingdog: has joined #ruby
[00:33:24] mjolnird: has joined #ruby
[00:48:30] karapetyan: has joined #ruby
[00:48:55] orbyt_: has joined #ruby
[00:51:13] shinnya: has joined #ruby
[00:53:46] Azure: has joined #ruby
[00:55:11] eckhardt: has joined #ruby
[00:58:16] raynold: has joined #ruby
[01:03:10] Purplex: has joined #ruby
[01:03:22] Purplex: Hi. Could someone help me with a gemfile problem?
[01:04:01] Purplex: whenever I run "bundle install" I get the following message
[01:04:02] Purplex: bundle install --deployment --without development test postgres aws
[01:04:07] Purplex: sorry not that one
[01:04:19] Purplex: Ignoring ffi-1.9.23 because its extensions are not built. Try: gem pristine ffi --version 1.9.23
[01:04:22] Purplex: Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
[01:04:25] Purplex: Ignoring gem-wrappers-1.3.2 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.3.2
[01:04:28] Purplex: Ignoring openssl-2.1.1 because its extensions are not built. Try: gem pristine openssl --version 2.1.1
[01:04:31] Purplex: Could not locate Gemfile
[01:04:34] Purplex: Could somebody help me please?
[01:04:39] elomatreb: has joined #ruby
[01:06:33] Purplex: what a bunch of idle cocksuckers...
[01:06:36] Purplex: has left #ruby: ()
[01:10:33] BlopMonster: has joined #ruby
[01:13:26] gigetoo: has joined #ruby
[01:18:41] theRoUS: has joined #ruby
[01:20:01] cagomez: has joined #ruby
[01:23:41] sytherax: has joined #ruby
[01:24:23] jrafanie: has joined #ruby
[01:25:49] white_lilies: has joined #ruby
[01:27:27] vivekananda: has joined #ruby
[01:33:19] wontruefree: has joined #ruby
[01:34:38] Radar: !ban Purplex
[01:34:38] ruby[bot]: +bb Purplex!*@*$#ruby-banned *!*@192.38.10.162$#ruby-banned
[01:38:13] ciscam: has joined #ruby
[01:40:42] gigetoo: has joined #ruby
[01:41:39] yokel: has joined #ruby
[01:44:57] TheBetrayer: has joined #ruby
[01:46:34] Tempesta: has joined #ruby
[01:47:44] jrafanie: has joined #ruby
[01:48:17] karapetyan: has joined #ruby
[01:53:51] sytherax: has joined #ruby
[01:53:56] dogweather: has joined #ruby
[02:01:20] cass_j: has joined #ruby
[02:07:12] sytherax: has joined #ruby
[02:07:25] dogweather: has joined #ruby
[02:07:51] gigetoo: has joined #ruby
[02:10:11] konsolebox: has joined #ruby
[02:12:11] cjohnson: 3 minutes!!!
[02:12:20] cjohnson: that escalated extremely quickly
[02:20:52] orbyt_: has joined #ruby
[02:22:05] t0xik: has joined #ruby
[02:25:02] dogweather: has joined #ruby
[02:29:19] BlopMonster: has joined #ruby
[02:30:02] nicht: has joined #ruby
[02:35:59] nicht: has joined #ruby
[02:37:05] esObe: has joined #ruby
[02:37:32] dogweather: has joined #ruby
[02:38:10] sparc: has joined #ruby
[02:38:23] rflot: has joined #ruby
[02:38:23] desnudopenguino: wow. that guy was somethin else
[02:38:30] pwillard: has joined #ruby
[02:38:34] caw________: has joined #ruby
[02:38:35] cstrahan_: has joined #ruby
[02:38:41] kireevco_: has joined #ruby
[02:38:53] boxrick1: has joined #ruby
[02:39:41] darkhanb: has joined #ruby
[02:43:42] BlopMonster: has joined #ruby
[02:44:47] ciscam: has joined #ruby
[02:49:07] dogweather: has joined #ruby
[02:50:04] SanguineAnomaly: has joined #ruby
[02:54:52] wontruefree: has joined #ruby
[02:55:57] TheBetrayer: has joined #ruby
[03:00:20] cadillac_: has joined #ruby
[03:09:06] gix: has joined #ruby
[03:11:14] braincrash: has joined #ruby
[03:11:56] kmurphy4: has joined #ruby
[03:15:03] garyserj: has joined #ruby
[03:17:06] levifig: has joined #ruby
[03:29:14] wontruef_: has joined #ruby
[03:30:18] rgiscard: has joined #ruby
[03:37:37] sytherax: has joined #ruby
[03:37:46] dogweather: has joined #ruby
[03:38:24] BlopMonster: has joined #ruby
[03:39:17] ciscam: has joined #ruby
[03:46:53] TheBetrayer: has joined #ruby
[03:50:00] karapetyan: has joined #ruby
[03:53:48] gigetoo: has joined #ruby
[03:55:15] nadir: has joined #ruby
[03:55:27] shinnya: has joined #ruby
[03:57:26] sytherax: has joined #ruby
[03:59:51] gigetoo: has joined #ruby
[04:04:04] johnny56: has joined #ruby
[04:05:51] hfp_work: has joined #ruby
[04:12:20] BloopMonster: has joined #ruby
[04:19:28] zlogan2003: has joined #ruby
[04:25:02] sshock: has joined #ruby
[04:28:10] machinewar: has joined #ruby
[04:28:44] SeepingN: has joined #ruby
[04:32:23] tty: has joined #ruby
[04:32:52] jenrzzz: has joined #ruby
[04:32:52] jenrzzz: has joined #ruby
[04:33:31] BlopMonster: has joined #ruby
[04:40:21] tty: has joined #ruby
[04:40:44] metalbot: has joined #ruby
[04:41:00] tty: has joined #ruby
[04:41:03] roamingdog: has joined #ruby
[04:41:49] shakes: has joined #ruby
[04:43:22] WAFFLEMAKER3000: has joined #ruby
[04:51:36] karapetyan: has joined #ruby
[04:58:26] PixeLInc: has joined #ruby
[05:02:10] justinmrkva: has joined #ruby
[05:09:31] sshock: has joined #ruby
[05:15:01] sauvin: has joined #ruby
[05:15:37] dogweather: has joined #ruby
[05:23:19] jcarl43: has joined #ruby
[05:23:24] UncleCid__: has joined #ruby
[05:27:11] thinkpad: has joined #ruby
[05:27:53] chat: has joined #ruby
[05:31:41] Inline: has joined #ruby
[05:34:18] reber: has joined #ruby
[05:35:11] zapata: has joined #ruby
[05:35:27] Puffball: has joined #ruby
[05:38:26] terces: has joined #ruby
[05:43:44] SeepingN: has joined #ruby
[05:50:21] sshock: has left #ruby: ()
[05:54:33] dogweather: has joined #ruby
[05:58:59] metalbot: has joined #ruby
[06:02:05] conta: has joined #ruby
[06:08:09] dogweather: has joined #ruby
[06:10:31] dionysus69: has joined #ruby
[06:16:24] pwnd_nsfw`: has joined #ruby
[06:17:27] aupadhye: has joined #ruby
[06:19:54] dionysus69: has joined #ruby
[06:20:17] jenrzzz: has joined #ruby
[06:20:18] jenrzzz: has joined #ruby
[06:25:15] amelliaa: has joined #ruby
[06:27:29] biberu: has joined #ruby
[06:31:27] Zarthus: has joined #ruby
[06:32:40] mtkd: has joined #ruby
[06:36:41] BTRE: has joined #ruby
[06:48:08] schleppel: has joined #ruby
[06:49:33] mtkd: has joined #ruby
[06:50:54] bijan_: has joined #ruby
[06:50:56] amar: has joined #ruby
[06:54:11] karapetyan: has joined #ruby
[06:54:50] bijan_: Hi, I already posted this to the rails channel but maybe it is fileutils related: I get several warnings on rails s command complaining about fileutils.rb and "warning: already initialized constant" for some constants. Same on two machines with latest rails gem, ruby 2.5.1 via rbenv. Log: https://gist.github.com/gobijan/cff23d11c0a5b779fde22fa099ed8a39
[06:55:02] bijan_: Anyone has an idea what is wrong here?
[06:58:37] yohji: has joined #ruby
[06:58:41] andikr: has joined #ruby
[07:00:44] DarkUnicorn: has joined #ruby
[07:07:30] sysvalve: has joined #ruby
[07:09:53] claudiuinberlin: has joined #ruby
[07:13:07] BlopMonster: has joined #ruby
[07:17:59] TomyWork: has joined #ruby
[07:28:01] tvw: has joined #ruby
[07:28:47] tvw: has joined #ruby
[07:29:44] n3b: has joined #ruby
[07:32:38] bijan_: has joined #ruby
[07:39:59] mostly-harmless: has joined #ruby
[07:44:55] RougeR: has joined #ruby
[07:48:53] boo: has joined #ruby
[07:51:55] cabotto: has joined #ruby
[07:52:28] rr-4: hello why rubygems stored gems with name '_' etc?
[07:52:38] rr-4: how do it?
[07:52:42] Dabo: has joined #ruby
[07:57:13] zmo: has joined #ruby
[08:01:44] fmccann: has joined #ruby
[08:03:09] bathtub_shark: has joined #ruby
[08:04:10] burgestrand: has joined #ruby
[08:05:26] vovs03: has joined #ruby
[08:07:21] hurricanehrndz: has joined #ruby
[08:14:22] mikecmpbll: has joined #ruby
[08:15:02] dogweather: has joined #ruby
[08:15:15] conta: has joined #ruby
[08:18:15] subroot: has joined #ruby
[08:23:19] ams__: has joined #ruby
[08:24:14] arekushi: has joined #ruby
[08:36:21] sphenxes: has joined #ruby
[08:36:35] dogweather: has joined #ruby
[08:43:42] Mia: has joined #ruby
[08:43:42] Mia: has joined #ruby
[08:43:58] WAFFLEMAKER3000: has joined #ruby
[08:52:11] BlopMonster: has joined #ruby
[08:53:37] dogweather: has joined #ruby
[08:55:05] GeorgesLeYeti: has joined #ruby
[08:55:29] Nicmavr: has joined #ruby
[08:55:29] jud^: has joined #ruby
[08:55:37] karapetyan: has joined #ruby
[09:00:10] Beams: has joined #ruby
[09:05:08] alex``: has joined #ruby
[09:15:02] dogweather: has joined #ruby
[09:22:31] GeorgesLeYeti: has joined #ruby
[09:22:50] zapata: has joined #ruby
[09:24:14] ellcs: has joined #ruby
[09:25:04] rblasucci_: has joined #ruby
[09:25:32] GeorgesLeYeti: I'm trying to make a function which convert 2 text into 1. These text can be pretty long. My question is, is it preferable to pass in parametre of my fucntion directly the text or a path of file (containing my text)
[09:26:15] dminuoso: GeorgesLeYeti: you can use lazy enumerators =)
[09:26:27] dminuoso: (Which is much more elegnat than passing paths around)
[09:26:54] dminuoso: GeorgesLeYeti: What kind of conversion is it?
[09:27:49] GeorgesLeYeti: Don't really know how to explain
[09:28:31] dminuoso: You can use the English language if you like. Or maybe some sample data
[09:28:32] GeorgesLeYeti: My 2 text are really close. So it compare the 2 text and try to align the 1st text with the 2nd
[09:29:17] dminuoso: GeorgesLeYeti: Use lazy file enumerators I'd say
[09:29:52] GeorgesLeYeti: dminuoso, Ok ty you. Don't know what it is but i ll check
[09:30:44] aupadhye_: has joined #ruby
[09:30:57] dminuoso: GeorgesLeYeti: lazy enumerators enable efficient stream processing
[09:31:45] GeorgesLeYeti: ty. I'll try this
[09:32:25] rblasucci_: has joined #ruby
[09:40:44] dogweather: has joined #ruby
[09:47:52] chat_: has joined #ruby
[09:48:54] aupadhye_: has joined #ruby
[09:55:05] ciscam: has joined #ruby
[09:57:50] dogweath_: has joined #ruby
[10:04:24] cadillac_: has joined #ruby
[10:07:02] conta: has joined #ruby
[10:08:46] bbobb: has joined #ruby
[10:09:33] bbobb: has left #ruby: ()
[10:11:50] clemens31: has joined #ruby
[10:12:15] cabotto: has joined #ruby
[10:15:08] dogweath_: has joined #ruby
[10:16:25] hfp_work: has joined #ruby
[10:21:34] jottr: has joined #ruby
[10:23:25] dogweather: has joined #ruby
[10:25:05] NL3limin4t0r: has joined #ruby
[10:30:50] NL3limin4t0r: Is there a cleaner way to write this line? `new_value = value1.nil? && value2.nil? ? nil : !(value1 == false || value2 == false)`
[10:31:08] NL3limin4t0r: where values can be either `nil`, `true` or `false`.
[10:31:22] dminuoso: Haha this is funny.
[10:32:13] NL3limin4t0r: The intention is that if one of the 2 values is false the new value is set to false
[10:32:22] leitz: has joined #ruby
[10:32:31] NL3limin4t0r: if both are nil it is set to nil
[10:32:47] NL3limin4t0r: otherwise set to true
[10:33:53] dminuoso: NL3limin4t0r: Okay lets address this with some boolean algebra first
[10:33:59] venmx: has joined #ruby
[10:33:59] dminuoso: Assume for a second they cant be nil
[10:34:12] dminuoso: (... == true) and (... == false) are antipatterns
[10:34:40] NL3limin4t0r: I know, but nil is also falsey so.
[10:34:53] NL3limin4t0r: normaly you would just `value` or `!value`
[10:35:08] dminuoso: 12:33 dminuoso | Assume for a second they cant be nil
[10:35:33] dminuoso: !(!v || !b)
[10:35:36] dminuoso: Does this look sane to you?
[10:35:52] jamesaxl: has joined #ruby
[10:36:08] cdunklau: isn't that just !(v && b)
[10:36:14] dminuoso: No. it's (v && b)
[10:36:22] cabotto: has joined #ruby
[10:36:31] cdunklau: right that's modus ponens
[10:36:47] NL3limin4t0r: oops, I'm so dump sometimes
[10:36:58] cdunklau: err wait no, modus ponens is with if/then
[10:36:59] NL3limin4t0r: its indeed v && b
[10:37:11] leitz: if you have a hash with string keys, is there an easy way to convert the keys to symbols?
[10:37:33] dminuoso: NL3limin4t0r: Now if this was haskell I'd just say `liftA2 (&&)` and kick back =P
[10:38:07] dminuoso: NL3limin4t0r: Anyway. So now think about the first part of that
[10:38:15] dminuoso: new_value = value1.nil? && value2.nil? ? nil : ...
[10:38:22] dminuoso: Why do you care that *both* are nil?
[10:38:25] schleppel: has joined #ruby
[10:40:16] NL3limin4t0r: If both are nil the value should stay nil because than the default is used.
[10:40:26] dminuoso: NL3limin4t0r: and what if one of them is nil?
[10:41:10] NL3limin4t0r: if one of the values is nil the new value should become the other value
[10:42:04] dminuoso: NL3limin4t0r: the most expressive way I can think of is: (v1.nil? || v2.nil?) ? (v1 || v2) : (v1 && v2)
[10:42:28] dminuoso: For the simple reason it's compact and provides clarity to the reader.
[10:43:41] NL3limin4t0r: I agree that it's more clear, but doesn't handle the case that v1 is `false` and v2 is `nil`
[10:43:53] NL3limin4t0r: than `nil` is returned
[10:44:09] dminuoso: Of course it does.
[10:45:21] dminuoso: NL3limin4t0r: I'd say you are abusing nil too much.
[10:45:40] NL3limin4t0r: You got a point there
[10:48:29] burgestrand: has joined #ruby
[10:48:49] NL3limin4t0r: I guess I'll keep `(v1.nil? && v2.nil?) ? nil !(v1 == false || v2 == false)` for now
[10:49:18] donofrio: has joined #ruby
[10:50:48] zapata: has joined #ruby
[10:51:58] jrafanie: has joined #ruby
[10:52:01] apeiros: NL3limin4t0r: (v1 == v2 && !v1) ? v1 : true
[10:53:04] dminuoso: ACTION slaps apeiros
[10:53:14] apeiros: why'd you do that?!?
[10:53:18] apeiros: ACTION stares at dminuoso
[10:53:19] dminuoso: Don't support this nastyness!
[10:53:29] apeiros: why? logic reduction is fun.
[10:53:43] dminuoso: Im gonna show you the coolest thing
[10:53:51] apeiros: sure. at least I liked it at uni.
[10:54:11] apeiros: but then again, back then I knew how, now I just "wing" it :-/
[10:56:44] NL3limin4t0r: apeiros: That's pretty small, but doesn't handle a `nil` and `false` input.
[10:57:00] apeiros: it handles it exactly the way you described
[10:57:02] dminuoso: NL3limin4t0r: I suggest you fix your logic.
[10:57:04] apeiros: it'll be true in that case.
[10:57:18] dminuoso: It's things like that that make ruby code downright unreadable
[10:57:18] apeiros: or did you update your initial spec? I only read that one.
[10:57:19] karapetyan: has joined #ruby
[10:57:27] apeiros: 12:32 NL3limin4t0r: The intention is that if one of the 2 values is false the new value is set to false
[10:57:29] dminuoso: It forces a reader to sit in front of that line of code for 2 minutes and write down truth tables
[10:57:31] apeiros: 12:32 NL3limin4t0r: if both are nil it is set to nil
[10:57:35] dminuoso: It's time wasted.
[10:57:37] apeiros: 12:32 NL3limin4t0r: otherwise set to true
[10:57:45] apeiros: so false & nil => true
[10:58:04] apeiros: >> v1 = nil; v2 = false; (v1 == v2 && !v1) ? v1 : true
[10:58:05] ruby[bot]: apeiros: # => true (https://eval.in/1021237)
[10:58:06] NL3limin4t0r: 12:41:10 NL3limin4t0r | if one of the values is nil the new value should become the other value
[10:58:29] apeiros: ok, so you did update your original spec.
[10:59:04] zapata: has joined #ruby
[10:59:06] apeiros: in that case, I'd go for readability and use case/when
[10:59:28] dminuoso: apeiros: Time travelling monads: https://gist.github.com/paf31/9d84ecf6a6a9b69cdb597a390f25764d
[11:00:12] NL3limin4t0r: This is the output I expect: nil + nil = nil ; nil + fasle = false ; nil + true = true ; true + true = true ; true + false = false
[11:00:41] dminuoso: NL3limin4t0r: Fix your design.
[11:00:48] dminuoso: You do not want this.
[11:01:02] dminuoso: This gross misusage of `nil` contributes to the billion dollar mistake.
[11:02:34] NL3limin4t0r: dminuoso: yeah, yeah, I know the design is broken but I'm not fixing that for now. That's something for the future.
[11:03:50] apeiros: note: future is an euphemism for "never" 😂
[11:04:47] dminuoso: apeiros: https://chrisdone.com/posts/twitter-problem-loeb there's some context for the problem (with a slightly worse written version of that)
[11:04:58] dminuoso: apeiros: It's an interesting problem to consider thats for sure :)
[11:06:58] apeiros: well, I've got a different problem to solve now. got to find a power cord for a foreign power supply :-S
[11:07:05] apeiros: it's a standard plug, but I don't know the name.
[11:08:38] BloopMonster: has joined #ruby
[11:09:53] NL3limin4t0r: apeiros: https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets
[11:13:27] apeiros: NL3limin4t0r: hm, not on it
[11:13:58] apeiros: it's similar to the power plug you find in old cassette recorder, just 3 connectors instead of 2
[11:14:45] apeiros: I think it's an IEC C6
[11:15:47] mtkd: has joined #ruby
[11:16:03] cdunklau: apeiros: is it a laptop psu?
[11:16:11] apeiros: cdunklau: correct
[11:16:18] apeiros: and it's definitively an IEC C6 :)
[11:16:21] cdunklau: almost certainly C6
[11:16:28] apeiros: now to the joy of finding a cord for that in a shop around here :-S
[11:16:39] chat: has joined #ruby
[11:16:44] cdunklau: apeiros: do you not have any cord for it?
[11:17:11] apeiros: nope. none that fits our power plugs :)
[11:17:21] apeiros: (it's not for my laptop, got a visitor who stays a couple of weeks)
[11:17:47] cdunklau: apeiros: right but they have a cord, right?
[11:18:53] cdunklau: apeiros: it might be easier to find a pin adapter for the plug side of their cord, assuming the PSU is a switching supply, which it most likely is if it has a C6 inlet
[11:20:05] biberu: has joined #ruby
[11:22:52] zapata_: has joined #ruby
[11:23:41] jrafanie: has joined #ruby
[11:28:28] chat_: has joined #ruby
[11:29:50] bijan_: has joined #ruby
[11:30:39] donofrio: has joined #ruby
[11:35:14] BlopMonster: has joined #ruby
[11:35:24] ldnunes: has joined #ruby
[11:37:57] dogweather: has joined #ruby
[11:41:29] sytherax: has joined #ruby
[11:42:05] AJA4350: has joined #ruby
[11:44:18] Es0teric: has joined #ruby
[11:45:52] dendazen: has joined #ruby
[11:47:59] biberu: has joined #ruby
[11:50:07] karapetyan: has joined #ruby
[11:54:52] dogweather: has joined #ruby
[11:57:09] burgestrand: has joined #ruby
[11:58:25] gheegh: has joined #ruby
[11:58:39] cyberg: has joined #ruby
[12:02:53] rgiscard: has joined #ruby
[12:05:11] mikecmpb_: has joined #ruby
[12:07:09] apparition47: has joined #ruby
[12:12:29] dogweather: has joined #ruby
[12:16:39] dionysus70: has joined #ruby
[12:18:09] cagomez: has joined #ruby
[12:20:35] apeiros: nice, found one :D first shop, not even a minute. didn't expect that.
[12:24:38] gray_-_wolf: has joined #ruby
[12:25:07] dogweather: has joined #ruby
[12:32:08] amatas: has joined #ruby
[12:33:08] za1b1tsu: has joined #ruby
[12:38:04] _aeris_: has joined #ruby
[12:38:54] Cthulu201: has joined #ruby
[12:41:56] aufi: has joined #ruby
[12:42:00] bijan_: has joined #ruby
[12:42:15] dogweather: has joined #ruby
[12:43:38] conta1: has joined #ruby
[12:43:39] Inline: has joined #ruby
[12:49:35] fmcgeough: has joined #ruby
[12:54:15] mr_rich101: has joined #ruby
[12:55:15] deathwishdave: has joined #ruby
[12:55:56] workmad3: has joined #ruby
[12:57:23] za1b1tsu: has joined #ruby
[12:59:27] dogweather: has joined #ruby
[13:00:19] Asher: has joined #ruby
[13:00:58] psychicist__: has joined #ruby
[13:01:17] jrafanie: has joined #ruby
[13:11:12] RougeR: has joined #ruby
[13:11:13] RougeR: has joined #ruby
[13:16:59] gnufied: has joined #ruby
[13:22:11] subroot: has joined #ruby
[13:22:37] potatoe`: has joined #ruby
[13:32:38] jcalla: has joined #ruby
[13:33:40] dogweather: has joined #ruby
[13:34:48] leitz: if you have a hash with string keys, is there an easy way to convert the keys to symbols?
[13:36:18] apeiros: leitz: Hash#transform_keys
[13:36:33] leitz: apeiros, thanks!
[13:37:05] apeiros: though, only in newer rubies
[13:37:13] apeiros: map + to_h in older versions.
[13:43:10] NL3limin4t0r: leitz: Introduced in 2.5.0 to be exact.
[13:43:57] Zarthus: Nice. That's a good feature
[13:44:06] Zarthus: I remember having to need this all too often.
[13:44:09] NL3limin4t0r: If you'll use it with the RoR framework you can also use Hash#symbolize_keys
[13:44:15] leitz: Should work in 2.6 then.
[13:44:29] Zarthus: NL3limin4t0r: I imagine #symbolize_keys is only one-way.
[13:45:59] NL3limin4t0r: Zarthus: I don't exactly know what you mean with one-way, documentation can be found here: http://api.rubyonrails.org/classes/Hash.html#method-i-symbolize_keys
[13:46:26] NL3limin4t0r: I have to go though, got a meeting
[13:46:31] Zarthus: it doesn't convert symbols to strings :P
[13:46:39] Zarthus: stringify_keys() exists, though.
[13:46:44] NL3limin4t0r: Ah, nope, it doesn't
[13:55:01] dogweather: has joined #ruby
[13:56:46] ciscam: has joined #ruby
[13:57:02] lbracher: has joined #ruby
[14:00:04] workmad3: has joined #ruby
[14:00:12] lbracher: Hi there! I'm having a bad time trying to install passenger extension for apache using rvm. I'm not able to call gem binary directly from command line, although I'm able to do `rvm all do gem install passenger`. But this doesn't work with step by step provided by https://www.phusionpassenger.com/library/install/apache/install/oss/rubygems_rvm/ . Any ideas?
[14:00:22] Asher: has joined #ruby
[14:01:39] dionysus70: has joined #ruby
[14:01:59] bmurt: has joined #ruby
[14:04:54] amelliaa: has joined #ruby
[14:09:02] havenwood: lbracher: Do you get `command not found` with?: gem
[14:09:05] havenwood: lbracher: Or how does it not work?
[14:09:21] za1b1tsu: has joined #ruby
[14:09:26] Rapture: has joined #ruby
[14:09:34] havenwood: lbracher: What do you get for?: which -a gem
[14:09:47] havenwood: lbracher: printenv PATH
[14:09:50] konsolebox: has joined #ruby
[14:10:11] havenwood: lbracher: rvm current
[14:10:18] havenwood: lbracher: Show us those? ^
[14:10:58] lbracher: havenwood, I get command not found. which -a gem gives me nothing.
[14:11:08] lbracher: printenv PATH: /home/ubuntu/.rvm/gems/ruby-2.3.3/bin:/home/ubuntu/.rvm/gems/ruby-2.3.3@global/bin:/home/ubuntu/.rvm/gems/ruby-2.4.1/bin:/home/ubuntu/.rvm/gems/ruby-2.4.1@global/bin:/home/ubuntu/.rvm/gems/ruby-2.3.3/bin:/home/ubuntu/.rvm/gems/ruby-2.3.3@global/bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin
[14:11:30] lbracher: rvm current -> system
[14:12:15] dogweather: has joined #ruby
[14:14:34] havenwood: lbracher: What RVM Ruby version are you trying to use?
[14:15:03] havenwood: lbracher: I'd suggest: rvm --default use ruby
[14:15:26] havenwood: lbracher: rvm --default use ruby-2.3.3
[14:15:44] havenwood: lbracher: An aside, but 2.3.7 is the latest 2.3.
[14:15:45] bijan_: has joined #ruby
[14:16:08] havenwood: lbracher: rvm get head && rvm upgrade 2.3.3 2.3.7
[14:16:18] havenwood: (If you want to bump to 2.3.7.)
[14:16:44] havenwood: lbracher: It seems you don't have a default RVM Ruby set. In absence of a default, RVM defaults to system.
[14:16:55] lbracher: I know, but unfortunately I'm not able to upgrade it due to an incompatibility with gem devise.
[14:17:08] lbracher: So I'm using this version for now.
[14:17:20] havenwood: lbracher: If 2.3.3 works, 2.3.7 ought work.
[14:17:26] havenwood: lbracher: They're both Ruby 2.3.
[14:17:38] lbracher: havenwood, it worked! :)
[14:17:48] lbracher: Thanks a lot! :)
[14:17:54] havenwood: You're welcome.
[14:18:12] lbracher: But just to understand, what happened exactly?
[14:18:33] lbracher: What I missed?
[14:18:35] havenwood: lbracher: Installing RVM and then installing a Ruby with RVM doesn't make that Ruby the default Ruby.
[14:20:02] lbracher: Well, thank you a lot! This is my third day on ruby. :)
[14:21:01] safetypin: has joined #ruby
[14:21:24] havenwood: lbracher: Welcome!
[14:22:44] WAFFLEMAKER3000: has joined #ruby
[14:25:47] tomeaton17: has joined #ruby
[14:27:26] venmx: has joined #ruby
[14:29:33] dogweather: has joined #ruby
[14:36:26] safetypin: has joined #ruby
[14:37:30] clemens31: has joined #ruby
[14:38:07] deathwishdave: has joined #ruby
[14:38:10] gizmore: has joined #ruby
[14:42:23] dogweather: has joined #ruby
[14:43:58] Mia: has joined #ruby
[14:44:07] Mia: has joined #ruby
[14:47:39] amatas: has joined #ruby
[14:53:55] GodFather: has joined #ruby
[14:54:37] dogweather: has joined #ruby
[14:56:08] BlopMonster: has joined #ruby
[14:59:18] karapetyan: has joined #ruby
[15:02:16] rippa: has joined #ruby
[15:03:40] kmurphy4: has joined #ruby
[15:05:42] akaiiro: has joined #ruby
[15:05:59] nowhereman_: has joined #ruby
[15:07:31] dogweather: has joined #ruby
[15:24:03] tcopeland: has joined #ruby
[15:25:06] dogweather: has joined #ruby
[15:30:31] beefjoe: has joined #ruby
[15:32:10] alex``: has joined #ruby
[15:34:28] weird_error: has joined #ruby
[15:42:10] dogweather: has joined #ruby
[15:44:24] yokel: has joined #ruby
[15:45:18] ciscam: has joined #ruby
[15:52:28] Asher: has joined #ruby
[15:53:56] dbugger_: has joined #ruby
[15:53:56] cagomez: has joined #ruby
[15:57:08] cagomez: has joined #ruby
[15:57:42] cagomez: has joined #ruby
[16:01:07] dogweather: has joined #ruby
[16:06:02] mtkd: has joined #ruby
[16:06:37] KeyJoo: has joined #ruby
[16:07:36] BlopMonster: has joined #ruby
[16:12:13] eckhardt: has joined #ruby
[16:14:31] roamingdog: has joined #ruby
[16:15:22] sanscoeur: has joined #ruby
[16:18:22] cagomez: has joined #ruby
[16:21:18] jcarl43: has joined #ruby
[16:21:22] darkhanb: has joined #ruby
[16:25:56] karapetyan: has joined #ruby
[16:28:19] karapetyan: has joined #ruby
[16:29:33] wontruefree: has joined #ruby
[16:30:14] FernandoBasso: has joined #ruby
[16:34:19] lxsameer: has joined #ruby
[16:35:30] za1b1tsu: has joined #ruby
[16:39:05] Muz: has joined #ruby
[16:39:38] [Butch]: has joined #ruby
[16:42:00] lxsameer: has joined #ruby
[16:51:07] workmad3: has joined #ruby
[16:51:27] Zaab1t: has joined #ruby
[16:52:01] lxsameer: has joined #ruby
[16:55:07] dogweather: has joined #ruby
[16:59:14] bijan_: has joined #ruby
[16:59:53] orbyt_: has joined #ruby
[17:00:46] nowhereman_: has joined #ruby
[17:02:39] desperek: has joined #ruby
[17:05:53] jenrzzz: has joined #ruby
[17:05:54] jenrzzz: has joined #ruby
[17:07:15] kapil___: has joined #ruby
[17:07:58] dogweather: has joined #ruby
[17:08:22] synthroid: has joined #ruby
[17:09:04] priodev: has joined #ruby
[17:11:38] wontruefree: has joined #ruby
[17:13:10] ltp: has joined #ruby
[17:15:27] quobo: has joined #ruby
[17:16:42] za1b1tsu: has joined #ruby
[17:20:40] dogweather: has joined #ruby
[17:22:35] WAFFLEMAKER3000: has joined #ruby
[17:22:48] solocshaw: has joined #ruby
[17:23:17] millerti: has joined #ruby
[17:25:25] Lytol: has joined #ruby
[17:25:58] weird_error: has joined #ruby
[17:27:29] Eiam: has joined #ruby
[17:30:03] shah^: has joined #ruby
[17:32:10] lxsameer: has joined #ruby
[17:32:38] spiette: has joined #ruby
[17:34:15] Mike11: has joined #ruby
[17:41:07] Guest39541: has joined #ruby
[17:42:02] dogweather: has joined #ruby
[17:42:19] lxsameer: has joined #ruby
[17:42:49] Guest39541: has joined #ruby
[17:45:36] priodev: has joined #ruby
[17:52:10] lxsameer: has joined #ruby
[17:52:50] sameerynho: has joined #ruby
[17:53:56] jenrzzz: has joined #ruby
[17:53:56] jenrzzz: has joined #ruby
[17:58:31] roamingdog: has joined #ruby
[17:59:21] roamingdog: has joined #ruby
[18:00:06] roamingdog: has joined #ruby
[18:00:58] roamingdog: has joined #ruby
[18:01:32] karapetyan: has joined #ruby
[18:01:43] roamingdog: has joined #ruby
[18:02:33] roamingdog: has joined #ruby
[18:03:27] dogweather: has joined #ruby
[18:12:28] omth: has joined #ruby
[18:13:41] conta1: has joined #ruby
[18:14:16] omth_: has joined #ruby
[18:17:20] cagomez: has joined #ruby
[18:17:40] cagomez: has joined #ruby
[18:18:33] DarkUnicorn: has joined #ruby
[18:19:25] camilasan: has joined #ruby
[18:20:01] spiette: has joined #ruby
[18:26:45] zachk: has joined #ruby
[18:27:14] zachk: has joined #ruby
[18:28:14] phenom: has joined #ruby
[18:44:31] cthulchu: a has access to @ivar. a creates ab object of b. Can I use @ivar seemlessly in b without explicitly passing it in?
[18:44:45] cthulchu: I have to pass it
[18:51:40] cthulchu: so .new() calls a constructor
[18:51:55] cthulchu: or rather creates an object and calls the constructor
[18:52:06] lxsameer: has joined #ruby
[18:52:18] cthulchu: It's not quite clear if its arguments are getting passed to the constructor
[18:53:48] WAFFLEMAKER3000: has joined #ruby
[18:54:43] dogweather: has joined #ruby
[18:55:14] aruns: has joined #ruby
[18:57:22] ltp: has joined #ruby
[18:57:43] priodev: has joined #ruby
[18:59:19] aruns: Hey guys, quick question, I was playing around with Ruby's CGI module last week, are CGI sessions supposed to be similar to cookies?
[18:59:58] aruns: Could I persist the user state in a single CGI session?
[19:00:32] Rapture: has joined #ruby
[19:02:04] lxsameer: has joined #ruby
[19:06:38] sanscoeur: has joined #ruby
[19:11:10] wontruefree: has joined #ruby
[19:12:16] lxsameer: has joined #ruby
[19:13:55] gizmore: aruns: Cookies are a feature of http. You set cookies via server response header "Set-Cookie: ...." ..... you resend cookies via client request header "Cookie: "
[19:14:16] BloopMonster: has joined #ruby
[19:14:36] cagomez: has joined #ruby
[19:14:42] gizmore: aruns: you can try to solve this "hacking challenge" to learn about cookies: https://www.wechall.net/challenge/training/programming1/index.php
[19:15:19] gizmore: meh... seems like the challenge needs signup :/
[19:16:39] schneider: has joined #ruby
[19:20:35] dogweather: has joined #ruby
[19:26:38] anisha: has joined #ruby
[19:31:54] cdunklau: does ruby have some kind of standardized HTTP application interface?
[19:32:02] cdunklau: like, say, WSGI for python?
[19:32:24] cdunklau: Rack looks similarish
[19:33:03] roamingdog: has joined #ruby
[19:36:53] bijan_: has joined #ruby
[19:37:30] Nicmavr: has joined #ruby
[19:37:34] cthulchu: what's a hash?
[19:37:40] dogweather: has joined #ruby
[19:37:50] cthulchu: I mean, I know what a hash is, but what is it as Ruby's data structure?
[19:38:03] cthulchu: I'm getting no implicit conversion of Hash into String
[19:38:08] cthulchu: I expected it
[19:38:23] gizmore: cthulchu: a hash is a dictionary in most other langs.... in php its an assoc array
[19:38:34] cthulchu: interesting
[19:38:43] gizmore: in js it's "Object" {}
[19:38:49] gizmore: in ruby it's "Hash" {}
[19:39:02] cthulchu: Ruby calls objects hashes!
[19:39:33] gizmore: most people here will cry over your definition but... if you like to say so.... Ruby calls (js) objects hashes!
[19:39:46] gizmore: in ruby, everything is Object :)
[19:39:51] gizmore: in ruby there are no primitives
[19:40:01] gizmore: Hash < Object
[19:40:07] gizmore: class Hash < Object
[19:40:13] gizmore: (i assume)
[19:40:21] gizmore: i once wrote a tut if you come from php to ruby
[19:40:22] cthulchu: so in JS we have stringify in objects
[19:40:35] cthulchu: what's ruby way to get json version of an object?
[19:40:39] gizmore: in ruby you would implement your own or use a gem like "json"
[19:40:47] gizmore: let me google it
[19:41:03] cthulchu: I mean, if it has JSON.parse
[19:41:09] cdunklau: cthulchu: js objects have string (or symbol) keys
[19:41:11] cthulchu: I would expect it to have the opposite
[19:41:25] cthulchu: and Ruby doesn't?
[19:41:27] cdunklau: ruby's hashes can have anything as a key
[19:41:28] cthulchu: Ruby has it too
[19:41:45] cdunklau: (modulo i don't know if hashability matters in ruby)
[19:41:45] cthulchu: so now everything has to have a .toString
[19:41:49] cthulchu: to stringify it properly
[19:41:53] cthulchu: what a mess...
[19:42:12] gizmore: cdunklau: i recently did @hash[self.class] = self.class.new ....... and self.class turned into a string?
[19:42:12] cdunklau: cthulchu: JS does have a Map thing in recent versions
[19:42:13] mozzarella: wtf am I reading
[19:42:17] cthulchu: why would you use an image as a key? :)
[19:42:23] cdunklau: gizmore: really?
[19:42:28] cdunklau: i'm a totally off?
[19:42:36] cdunklau: *am i totally off*
[19:42:37] gizmore: cdunklau: not sure.... i pondered... let me check
[19:43:02] cthulchu: I want something more... simple
[19:43:11] gizmore: cthulchu: https://stackoverflow.com/questions/3183786/how-to-convert-a-ruby-hash-object-to-json
[19:43:23] gizmore: this is what you want, i think :)
[19:43:55] cthulchu: interesting
[19:43:59] cthulchu: many thanks
[19:44:02] gizmore: you could also, for fun, monkeypatch some core datatypes with your own def own_json
[19:44:15] cthulchu: I'll try ruby as it should be first
[19:44:15] gizmore: you could class Numeric; def own_json; self; end; end
[19:44:22] cthulchu: wanna get that authentic taste first
[19:44:28] cdunklau: gizmore: i don't know what that @hash thing does
[19:44:38] gizmore: oh in ruby you have to think different
[19:44:48] gizmore: @hash means "instance variable"
[19:44:56] cdunklau: oh wait that's just the instance attribute sigel
[19:44:57] gizmore: @@hash would be a class variable
[19:45:05] cthulchu: so json is a default... gem?
[19:45:28] cthulchu: why renaming packages. everyone has packages, ruby calls them gems
[19:45:43] gizmore: cthulchu: it seems like #to_json is part of Kernel? (the main object) or Object?
[19:45:58] cthulchu: as it should be
[19:46:14] gizmore: ah no... you need to require "json"
[19:46:15] cdunklau: cthulchu: it's worse with python. a python "package" is a dir with python modules in it, not something you can really install (that would technically be a "distribution")
[19:46:17] cagomez: has joined #ruby
[19:46:45] cthulchu: so I have this weird thing
[19:46:53] cthulchu: in my superclass that calls my class
[19:46:56] cthulchu: require 'require_all'
[19:47:03] cthulchu: I assume json will be there
[19:47:04] gizmore: mozzarella: thanks for that msg ;P
[19:47:11] cdunklau: cthulchu: ...what?
[19:47:29] mozzarella: what message?
[19:47:42] cthulchu: that wasn't me
[19:47:42] cdunklau: cthulchu: you mean you have class A, and class B that inherits from A, but class A calls B?
[19:47:52] gizmore: the force you were reading... just let us amateurs get used to ruby! ^^
[19:48:28] cthulchu: not quite... I have class A that creates an object of class B. Class A has all the requires. Class B has none. I'm in B.
[19:48:39] cthulchu: I think B will be able to use A's requires
[19:48:50] cthulchu: hell I have never coded as dirty as this
[19:48:57] cthulchu: nothing is reusable and everything is bootstraps
[19:49:20] cdunklau: gizmore: hmm classes work fine as keys...
[19:49:36] cthulchu: but why would you make a class a key
[19:49:40] cthulchu: unless you're hacking
[19:49:49] gizmore: cdunklau: thanks.... then i have a bug/problem in my code ... thx :)
[19:49:50] cdunklau: gizmore: https://bpaste.net/show/59ff0735af28
[19:50:10] cthulchu: it's ruby! it has no bugs. Only features!
[19:50:16] cdunklau: cthulchu: it might be reasonable, say you need to dispatch behavior based on the type of the thing you get
[19:50:20] gizmore: << {Module: 1}.inspect
[19:50:28] gizmore: >> {Module: 1}.inspect
[19:50:33] cthulchu: oh, interesting
[19:50:36] gizmore: how does the bot works again?
[19:51:06] cdunklau: gizmore: >> should do it
[19:51:13] cdunklau: >> puts 123
[19:51:14] ruby[bot]: cdunklau: # => 123 ...check link for more (https://eval.in/1021560)
[19:51:19] gizmore: cthulchu: i came a long way from an own php framework to rails to an own php7 framework back to pure ruby without dependencies
[19:51:35] gizmore: now my current project is https://github.com/gizmore/gdo
[19:51:37] cthulchu: I settled on Node
[19:51:43] gizmore: clone && bundle exec rake
[19:51:48] cdunklau: cthulchu: yeah that sounds really bad
[19:52:11] cthulchu: yes, .to_json works without require
[19:52:16] lxsameer: has joined #ruby
[19:52:17] cthulchu: because it's Ruby
[19:52:21] cthulchu: it's soooooo weird
[19:52:23] nowhereman_: has joined #ruby
[19:52:25] \void: has joined #ruby
[19:52:33] cdunklau: does ruby have a module cache?
[19:53:13] cdunklau: like, in python, when you do `import foo`, and then in another file also `import foo`, the second time it happens it just does a hash table lookup, it doesn't reexecute
[19:53:28] t0xik: has joined #ruby
[19:53:33] gizmore: cdunklau: if you do passenger or maybe most other stacks there is no clean on every request.... your caches will be way different compared to mod_php
[19:53:38] gizmore: how does cgi work?
[19:53:46] gizmore: process => code => kill=
[19:53:53] cdunklau: gizmore: ...what?
[19:54:04] gizmore: what do you mean with "module cache"?
[19:54:05] cdunklau: i'm having trouble understanding how that's relevant at all :)
[19:54:23] cdunklau: gizmore: like, you require a thing. the next time you require it, does it get reexecuted?
[19:54:34] gizmore: no, you will use "load" then
[19:55:02] gizmore: include is the equivalent to extend (btw) ... you include or extend a module
[19:55:08] gizmore: require is like load
[19:55:17] cdunklau: terminology collisions :)
[19:55:30] gizmore: and i might not be 100% right as well
[19:55:33] gizmore: also interesting:
[19:55:41] cdunklau: in python a module is the object you get when you import a file
[19:55:47] apeiros: gizmore: in JS, it's Map
[19:56:00] apeiros: Object in JS aren't really hashtables, though you can use them similar to one
[19:56:13] cdunklau: apeiros: can Map have arbitrary keys?
[19:56:15] apeiros: (and Map still lacks a proper equality protocol)
[19:56:23] apeiros: cdunklau: afaik yes, but ^
[19:56:24] roamingdog: has joined #ruby
[19:56:34] cdunklau: apeiros: i'm pretty sure everything in JS lacks a proper equality protocol :)
[19:56:36] apeiros: it's not as nice as in ruby where you can define #hash and #eql?
[19:56:42] gizmore: apeiros: may i query you for 30 seconds?
[19:56:59] apeiros: you mean pm? you can, but most questions I only answer in public :)
[19:57:14] roamingdog: has joined #ruby
[19:57:16] gizmore: i will do here then.... i need an excurse in bundler and gems. i want your time for 1-2h and i would pay like €20-€40 for your guidance
[19:57:24] dtzuzu: has joined #ruby
[19:57:45] gizmore: basically i need guidance and help in my gem layout for my little hobby project :)
[19:57:53] apeiros: oh honey, my fee is *slightly* above 40€ for an hour ;-) but I appreciate it. just ask, and if I can I'll answer for free.
[19:58:00] roamingdog: has joined #ruby
[19:58:20] cthulchu: folks, I have an array of hashes. I know I need an object that has in it a .name == "asd".
[19:58:28] cthulchu: should I iterate through them with a loop?
[19:58:34] cthulchu: or is there a more elegant way?
[19:58:49] roamingdog: has joined #ruby
[19:59:01] apeiros: cthulchu: I'm not sure I follow your question. you mean you need a hash which has hash["name"] == "asd"?
[19:59:03] cdunklau: cthulchu: do you mean a hash with the key "name" that refers to the value "asd"?
[19:59:07] dogweather: has joined #ruby
[19:59:11] apeiros: or do you need to turn your hashes into a different type of object?
[19:59:25] gizmore: apeiros: so i am working on a framework.... there will also be a bin/ provided in the main gem, that should know about own plugin gems.... like gem gdo knows about gem gdo-networking
[19:59:39] roamingdog: has joined #ruby
[19:59:45] cthulchu: you both are right
[19:59:51] lbracher: has joined #ruby
[19:59:52] apeiros: cthulchu: Array#find
[20:00:03] apeiros: and yes, that's essentially looping through
[20:00:06] apeiros: # denotes instance methods
[20:00:09] apeiros: :: denotes class methods
[20:00:16] apeiros: it's "documentation lingo"
[20:00:29] cthulchu: would Array.find work?
[20:00:34] apeiros: . is either when you use ri to search, but I avoid it as it's ambiguous
[20:00:53] apeiros: yes, [].find { |hash| hash[key] == value }
[20:01:04] cthulchu: >>[1,2,3,4]#find(1)
[20:01:05] ruby[bot]: cthulchu: # => [1, 2, 3, 4] (https://eval.in/1021566)
[20:01:11] apeiros: gizmore: I assume there's a "and I have issues with X" coming?
[20:01:21] apeiros: cthulchu: na, you always invoke methods with .
[20:01:32] cthulchu: >>[1,2,3,4].find(1)
[20:01:33] ruby[bot]: cthulchu: # => #<Enumerator: [1, 2, 3, 4]:find(1)> (https://eval.in/1021567)
[20:01:37] gizmore: apeiros: no... i did package mask >=x11-base/xorg-server-1.12
[20:01:37] apeiros: the # and :: are for documentation
[20:01:46] cdunklau: !class method
[20:02:04] apeiros: Array#find means "do foo.find where foo is an instance of Array"
[20:02:30] cthulchu: so find accepts an array as an attribute?
[20:02:39] gizmore: could also use [[],{}].select{|item|item.is_a?(Array)}
[20:02:39] cthulchu: >>1.find([1,2,3])
[20:02:40] ruby[bot]: cthulchu: # => undefined method `find' for 1:Fixnum (NoMethodError) ...check link for more (https://eval.in/1021568)
[20:02:43] apeiros: wherease Time::at means "call it literally on Time itself"
[20:02:52] gizmore: >>[[],{}].select{|item|item.is_a?(Array)}
[20:02:57] apeiros: yeah, 1 is not an instance of Array :-)
[20:03:00] karapetyan: has joined #ruby
[20:03:01] gizmore: >>[[],{}].select{|item|item.is_a?(Array)}[0] rescue nil
[20:03:29] cthulchu: what's wrong with this? >>[1,2,3,4].find(1)
[20:03:38] cdunklau: hmm. can someone point me to the doc that discusses class vs. instance method?
[20:03:46] apeiros: cthulchu: you probably should read the docs of find ;-)
[20:04:27] apeiros: gizmore: ok, I'm not sure where you need help
[20:04:38] apeiros: cthulchu: also this
[20:04:39] apeiros: 22:00 apeiros: yes, [].find { |hash| hash[key] == value }
[20:04:57] cthulchu: I don't get the {} after find
[20:05:09] cthulchu: are you talking documentation or code?
[20:05:11] cthulchu: confusing af
[20:05:15] cthulchu: can we just use code
[20:05:32] apeiros: that one was an actual code example
[20:05:43] cdunklau: apeiros: is that the proc thing
[20:05:43] apeiros: the {} is a block passed to find. basically a piece of code.
[20:05:51] gizmore: apeiros: https://github.com/gizmore/gdo/blob/master/bin/gdo .... why i need require mysql2.... also how does gem gdo binary know about other gem plugin gdo-networking
[20:05:55] cthulchu: so find accepts an anonymous function as an argument
[20:06:09] gizmore: apeiros: thank you very very much :)
[20:06:31] apeiros: cthulchu: yes. your "finding" strategy.
[20:06:42] cthulchu: will that "block" be executed on each element?
[20:06:48] cthulchu: how do we return success?
[20:07:13] cthulchu: so .find is almost .forEach?
[20:07:16] lxsameer: has joined #ruby
[20:07:24] sanscoeur: has joined #ruby
[20:07:43] apeiros: gizmore: hm, interesting. I'd expect Bundler.require(:default) to load mysql2 since it's in the gemspec
[20:07:46] apeiros: so don't know about that
[20:07:53] gizmore: thank you :)
[20:07:56] apeiros: I assume you tested without require and it didn't work?
[20:08:09] gizmore: got missing constant MySQL2
[20:08:12] apeiros: ok, that's something I'd have to look up myself
[20:08:18] cthulchu: actually I don't need find
[20:08:21] apeiros: so, good thing you didn't pay me money ;-D
[20:08:23] cthulchu: cuz it's boolean
[20:08:39] cthulchu: I need to return a hash that satisfied the search paeams
[20:08:43] gizmore: apeiros: btw.... "gdo" is a great new approach for a framework .... i would be happy if someone would run my rspec
[20:08:43] apeiros: cthulchu: find uses each, but unlike each, it stops once it found what you're looking for and returns that
[20:08:46] BlopMonster: has joined #ruby
[20:08:49] apeiros: cthulchu: and it returns nil if it doesn't find anything
[20:08:50] nicht: has joined #ruby
[20:08:56] gizmore: apeiros: i am currently writing README.MD
[20:08:57] apeiros: cthulchu: but all of that you can learn from reading find's docs ;-p
[20:09:13] cthulchu: they're confusing
[20:09:17] cthulchu: but I'll try again
[20:10:22] cdunklau: is Class... a metaclass?
[20:10:32] apeiros: gizmore: as for "how can it know about gdo-someplugin" - it can't if you use bundler. because you literally tell your code to ignore every gem which is not in the gemfile.
[20:10:48] cthulchu: `Passes each entry in enum to block. `
[20:10:56] cthulchu: what is in enum?
[20:11:21] apeiros: i.e. you'd have to list all plugins in the gemfile, but since you probably only want to install plugins when needed, that's a bit problematic. so either you circumvent bundler for that, or you don't use bundler at all. I'm not sure what a good approach would be.
[20:11:23] gizmore: apeiros: what is very unclear.... if someone would gem install gdo && gem install gdo-net ....... then he would $gdo --foo bar but how does gdo binary know about gdo-net without any gemfile?
[20:11:36] workmad3: has joined #ruby
[20:11:44] gizmore: apeiros: thank you very much!
[20:11:49] dogweather: has joined #ruby
[20:11:58] gizmore: btw.... gdo6(PHP) is very great... ten times better than laravel
[20:12:11] gizmore: also on github/gizmore/gdo6
[20:12:15] apeiros: I don't know laravel :)
[20:12:17] gizmore: but PHP is so.... argh
[20:12:21] gizmore: laravel is like rails in php
[20:12:26] gizmore: but they totally failed
[20:12:36] gizmore: code completion like <50%
[20:12:40] apeiros: I thought symphony was the big rails clone?
[20:12:52] gizmore: should try symphony :)
[20:13:00] cthulchu: this is crazy
[20:13:02] gizmore: everything good is a bit like rails
[20:13:09] cthulchu: why do they put .detect in manuals about .find
[20:13:13] cthulchu: so confusing
[20:13:28] cthulchu: I never ask about .detect and yet I see it more often than .find
[20:13:37] gizmore: cthulchu: an enum is a class that features #next and some other methods
[20:13:48] gizmore: it is iteratable
[20:13:58] cthulchu: it says it passes each element in enum
[20:14:10] gizmore: for each enum value (all)
[20:14:15] gizmore: pass to a &block
[20:14:21] gizmore: sounds like a bad idea
[20:14:27] apeiros: cthulchu: find & detect are aliases
[20:14:48] gizmore: sounds like a bad idea unless it iterates with #next.... i love ruby :P
[20:14:50] apeiros: basically if you do `ri Foo#somemethod` and you get `othermethod works like X`, it means othermethod and somemethod are aliases
[20:15:17] cthulchu: https://i.imgur.com/prdHGLS.png
[20:15:28] cthulchu: why not saying that they are the same?
[20:15:43] gizmore: https://github.com/gizmore/gdo/blob/master/lib/GDO/DB/Result.rb#L80 (only time i have enums atm)
[20:15:50] cthulchu: it's confusing af when we talk about find but examples are detect
[20:16:15] cthulchu: so in the block i is my item?
[20:16:26] cthulchu: again, why is it so subtle?
[20:16:29] cthulchu: how would I know
[20:16:34] apeiros: cthulchu: hm, I think that's supposed to be enum.find() { … }
[20:16:50] cthulchu: enum.find(i) { … }
[20:16:59] apeiros: no, not enum.find(i)
[20:17:04] lxsameer: has joined #ruby
[20:17:18] cthulchu: enum.find(function(i){...})
[20:17:21] apeiros: I mean, yes, if you want another value than nil for "no item found"
[20:17:43] cthulchu: but Ruby decided to make function(i) implicit
[20:17:46] apeiros: yes, that's what it essentially is. but blocks are a core syntax feature. and blocks are not passed that way.
[20:17:56] cagomez: has joined #ruby
[20:17:58] amatas: has joined #ruby
[20:18:05] cthulchu: so I can expect every block to use i?
[20:18:12] apeiros: and you really should read some book or intro :-p
[20:18:13] cthulchu: it's like untold truth?
[20:18:29] cthulchu: I will eventually :)
[20:18:43] apeiros: { |arg1, arg2, …| …code… }
[20:18:59] apeiros: you name the arguments. it's not untold truth. it's explicit truth you decide on your own.
[20:19:04] apeiros: ACTION afk for a bit now
[20:20:25] jenrzzz: has joined #ruby
[20:20:26] jenrzzz: has joined #ruby
[20:20:59] cthulchu: I prefer functions
[20:21:01] blackmesa: has joined #ruby
[20:21:39] cthulchu: event = dataLayer.find{|object|object.event=="gtm.timer"}
[20:22:18] cthulchu: thanks, apeiros
[20:23:01] Dabo: has joined #ruby
[20:23:45] SeepingN: has joined #ruby
[20:23:52] wontruefree: has joined #ruby
[20:26:40] ellcs: has joined #ruby
[20:27:02] lxsameer: has joined #ruby
[20:28:57] lbracher: has joined #ruby
[20:30:13] jenrzzz: has joined #ruby
[20:30:14] jenrzzz: has joined #ruby
[20:30:57] alex``: has joined #ruby
[20:35:43] duderonomy: has joined #ruby
[20:37:06] lxsameer: has joined #ruby
[20:37:42] mikecmpbll: has joined #ruby
[20:44:17] sanscoeur: has joined #ruby
[20:47:15] lxsameer: has joined #ruby
[20:47:57] mtkd: has joined #ruby
[20:49:26] clemens31: has joined #ruby
[20:54:15] unreal: has joined #ruby
[20:57:50] BloopMonster: has joined #ruby
[21:02:16] lxsameer: has joined #ruby
[21:04:25] karapetyan: has joined #ruby
[21:05:13] cthulchu: how do we check if a hash has a key
[21:05:30] z3uS: has joined #ruby
[21:05:41] sanscoeur: has joined #ruby
[21:07:29] apeiros: cthulchu: you need to learn how to use the docs :)
[21:07:58] apeiros: https://ruby-doc.org/core-2.5.1/Hash.html
[21:08:04] apeiros: I'm sure you'll find something ;-)
[21:09:35] jenrzzz: has joined #ruby
[21:09:38] fmcgeough: has joined #ruby
[21:10:45] cthulchu: we can't refer to values via dots like in JS
[21:10:51] cthulchu: it's uncomfortable, but ok
[21:11:19] cthulchu: we actually probably could
[21:11:26] cthulchu: it the key was a method
[21:11:48] Sylario: has joined #ruby
[21:12:18] lxsameer: has joined #ruby
[21:14:54] apeiros: cthulchu: take a look at OpenStruct
[21:15:38] cthulchu: why doesn't pry give me the output?
[21:16:05] SeepingN: why can't you be more vague?
[21:16:10] cthulchu: wait for it
[21:16:11] cthulchu: https://i.imgur.com/8yBMGsx.png
[21:17:34] cthulchu: it's cuz it was in a wrong state
[21:18:24] cthulchu: just have to puts
[21:23:46] wget: has joined #ruby
[21:24:13] akaiiro: has joined #ruby
[21:26:49] roamingdog: has joined #ruby
[21:27:17] wontruefree: has joined #ruby
[21:29:51] cthulchu: also puts is a weird word
[21:29:59] cthulchu: I wonder if we have a shortcut
[21:30:38] apeiros: I'd say it's taken from other languages
[21:30:46] apeiros: and is short already, for put string
[21:30:51] apeiros: vs. e.g. putc, put char
[21:31:56] cthulchu: why do we need different methods for putting char and string?
[21:32:07] lxsameer: has joined #ruby
[21:32:09] cthulchu: I mean, I always use just one... printer
[21:32:22] cthulchu: method for logging into console
[21:32:31] cthulchu: do we have puti?
[21:32:51] cthulchu: because casting integer into string requires an explicit method
[21:32:58] cthulchu: ok, ok, no rumbling
[21:33:10] apeiros: puts invokes to_s
[21:33:26] cthulchu: I guess I'll just make a p() method that would do puts
[21:33:31] apeiros: and almost all ruby classes respond to to_s already. so no puti necessary
[21:33:45] apeiros: maybe you should check before you do that :-p
[21:33:59] apeiros: note, p is not puts
[21:34:08] apeiros: but p is actually what you usually should use when debugging
[21:34:19] apeiros: p uses #inspect, instead of #to_s
[21:34:26] cthulchu: oh so cool!
[21:34:28] apeiros: and #inspect is a lot better in most cases.
[21:34:38] cthulchu: it probably shows the .class
[21:34:47] cthulchu: or whatever
[21:34:54] apeiros: also it means you can conveniently use it with a hash to have labeled stuff: `p foo: foo, bar: bar, …`
[21:35:05] cthulchu: oh that's a relief
[21:35:09] roamingd_: has joined #ruby
[21:35:11] KaitoDaumoto: has joined #ruby
[21:35:14] cthulchu: I keep doing puts and .to_json
[21:39:47] d5sx43: has joined #ruby
[21:42:04] lxsameer: has joined #ruby
[21:43:29] weaksauce: has joined #ruby
[21:45:10] BlopMonster: has joined #ruby
[21:48:16] zenspider: fanfuckingtastic. I'm slowly working on an rspec compatibility layer and I finally got dots today... Despite having some failures my runs are still 65% the time of rspec.
[21:48:38] jenrzzz: has joined #ruby
[21:48:38] jenrzzz: has joined #ruby
[21:49:12] SeepingN: (awesomeprint)
[21:49:21] SeepingN: when debugging arrays and hashes and objects
[21:49:32] duderonomy: has joined #ruby
[21:50:16] zenspider: SeepingN: in your tests or elsewhere?
[21:50:44] BloopMonster: has joined #ruby
[21:52:28] chouhoul_: has joined #ruby
[21:52:32] Zarthus: has joined #ruby
[21:56:55] cyberg: has joined #ruby
[21:57:24] mmattice: has joined #ruby
[21:58:30] BloopMonster: has joined #ruby
[21:59:10] Eiam: time to step into containerizing my ruby projects
[21:59:17] Eiam: ACTION sighs and gives into the future
[21:59:38] Dabo: has joined #ruby
[22:02:45] zenspider: wow! 504 specs. All passing now. Roughly the same time for the dots 0.2414s (minitest) vs 0.2535s (rspec)... but overall runtime is 1.046s vs 2.065s
[22:03:08] dogweather: has joined #ruby
[22:03:11] zenspider: Eiam: and now you have 8 problems
[22:03:55] wald0: has joined #ruby
[22:04:56] apeiros: if it's only 8 problems, they did a really good job!
[22:05:00] cadillac_: has joined #ruby
[22:05:37] roamingd_: has joined #ruby
[22:08:16] cthulchu: do you guys write blocks in one line?
[22:08:26] cthulchu: or do you treat them as actual code blocks?
[22:09:49] apeiros: whatever fits the situation
[22:10:14] cthulchu: do you smoke weed?
[22:10:44] zenspider: cthulchu: either stay on topic or go away
[22:10:49] cthulchu: I've learned ruby enough to know that this question is not out of context on the channel ;)
[22:11:03] cthulchu: ok, ok, I thought you'd appreciate a joke
[22:11:26] cthulchu: looks like this channel is stricter than the language itself :)
[22:12:12] zenspider: and yet here you are sticking with shitty signal:noise...
[22:12:17] workmad3: has joined #ruby
[22:12:51] cthulchu: the reason of that is your definition of signal:noise
[22:12:58] cthulchu: so blame yourself
[22:13:42] zenspider: you're about to be banned. The amount of time is up to you.
[22:13:44] jottr: has joined #ruby
[22:16:07] jrich523: <insert that escalated quickly meme>
[22:16:42] cthulchu: it always does with arrogant ops :)
[22:16:58] cthulchu: what array function would you suggest for finding all matching elements of an array rather than first
[22:17:04] lxsameer: has joined #ruby
[22:17:06] cthulchu: I use .find for the first one
[22:17:17] jrich523: i thought thats what that one was for?
[22:17:18] cthulchu: will it return an array?
[22:17:23] jrich523: hmm yeah think so
[22:17:31] cthulchu: cool, thanks
[22:17:32] jrich523: cuz there is select vs select! (assuming there is anyways)
[22:17:42] jrich523: return a new array vs modify inline
[22:17:52] jrich523: im only like one or two days ahead of you lol
[22:18:02] cthulchu: oh, okay :)
[22:18:37] roamingdog: has joined #ruby
[22:18:55] cthulchu: actually, I don't need it. I just need a foreach, I guess
[22:19:22] jrich523: yeah i mean technically the foreach will do basically anything you need
[22:19:41] jrich523: i used it a LOT (a tad stupidly) at first... now im using map and select for those stupid things lol
[22:19:48] cthulchu: I'm gonna just use it instead of all these weird shortcuts
[22:19:52] cthulchu: just have to find it
[22:19:57] cthulchu: .each Calls block once for each element in self, passing that element as a parameter, converting multiple values from yield to an array.
[22:20:03] cthulchu: why in self?
[22:20:08] cthulchu: not in enum
[22:20:19] cthulchu: find does it in enum and this one does it in self
[22:20:21] dogweather: has joined #ruby
[22:20:25] cthulchu: I suspect it's the same thing
[22:20:34] jrich523: because its .each
[22:20:36] jrich523: so it has to be self
[22:20:44] jrich523: but self IS the enum (hash/array)
[22:21:00] cthulchu: they use them interchangeably.
[22:21:08] zenspider: grep or find_all
[22:21:44] jrich523: i obviously know what grep is, but how does it apply to ruby?
[22:21:58] jrich523: is there a grep method i've overlooked?!
[22:22:02] cliluw: has joined #ruby
[22:22:23] zenspider: jrich523: try `ri grep` in your terminal
[22:22:38] jrich523: im windows.. but lets see what happens
[22:22:42] zenspider: if that doesn't work, you're missing out on a very useful tool
[22:22:44] zenspider: should still work
[22:22:56] zenspider: but some ruby setups bypass setting up the doco data
[22:22:59] jrich523: powershell prompts
[22:23:03] jrich523: ri - remove-itemn :)
[22:23:13] zenspider: ri.exe maybe?
[22:23:22] zenspider: or your pathing needs tweaking?
[22:23:33] zenspider: but if you can run irb, you should be able to run ri
[22:23:44] jrich523: oh, irb works fine
[22:24:17] zenspider: there's also grep_v, finally
[22:24:19] jrich523: there we go
[22:24:35] jrich523: hmm seems to be part of pry?
[22:26:05] zenspider: jrich523: part of rdoc and as a result, part of ruby
[22:26:32] jrich523: weird, so wouldnt ri show that? it listed a few... instances.. all from pry
[22:27:14] lxsameer: has joined #ruby
[22:27:18] zenspider: might not have the core ruby data installed, but it also searches through gems. Maybe pry has their own grep method
[22:27:38] BloopMonster: has joined #ruby
[22:27:39] zenspider: I thought you meant `ri` was part of pry, not `grep`
[22:27:43] jrich523: i guess while we're chatting about gems, is there any easy way to know what a gem exports?
[22:28:31] jrich523: sorry, yeah the grep return is telling me its part of pry, (from gem pry-0.11.3)
[22:29:28] schneider: has joined #ruby
[22:30:44] bmurt: has joined #ruby
[22:31:08] zenspider: jrich523: if you have things set up correctly, you should (also) see that grep is defined on Enumerable
[22:32:12] jrich523: https://gist.github.com/jrich523/318b403fb8b6928c12993cd0d7e7be2c
[22:32:17] jrich523: seems to only be from pry
[22:32:17] blackmesa: has joined #ruby
[22:33:17] zenspider: jrich523: "what a gem exports" -- no. That phrase has some expectations from other languages that ruby doesn't really live up to.
[22:33:28] zenspider: jrich523: do this: `ri Array`
[22:33:33] zenspider: I'm gessing you don't get anything
[22:33:45] cthulchu: we actually have the grep!
[22:33:56] jrich523: weird, from parser-2.5.1.0
[22:34:22] jrich523: lol looks like it can touch everything but core
[22:34:37] cthulchu: but can we do some actual work in the block to then return true or false?
[22:34:49] cthulchu: in other words, can we make blocks a little bit more functional?
[22:34:55] kmurphy4: has joined #ruby
[22:35:01] zenspider: jrich523: yeah. you're missing rdoc data...
[22:35:13] cthulchu: I don't mind having a non-instance method that would do that and return it into the block, I guess
[22:35:20] cthulchu: just don't know what is the best way
[22:35:23] cthulchu: will try the latter
[22:35:46] zenspider: I don't know how to fix that on windows... it depends on how you installed I think
[22:37:33] dogweather: has joined #ruby
[22:38:43] schneider: has joined #ruby
[22:38:47] Eiam: foreach is a little odd and it might be a good use case for inject or each_with_object
[22:39:18] dendazen: has joined #ruby
[22:40:46] cthulchu: I don't think there's foreach
[22:40:56] cthulchu: there are a bunch of stuff that is similar
[22:41:32] cthulchu: I decided to try .select
[22:42:06] zenspider: there's many foreach's
[22:44:46] jottr: has joined #ruby
[22:48:03] schneider: has joined #ruby
[22:48:33] jrich523: yeah im pretty sure what you want is select (to filter/trim the set)
[22:53:02] zenspider: rspec must be explicitly turning warnings off... horrible
[22:55:30] cthulchu: I'm not sure if I'm doing this right
[22:55:42] cthulchu: but it works
[22:55:49] jrich523: then it must be right!
[22:56:01] zenspider: I don't think that follows...
[22:56:06] cthulchu: it doesn't feel right cuz it becomes more syntax than JS's ,forEach
[22:56:29] cthulchu: I don't trust blocks
[22:56:33] jrich523: i did similar stuff at first too
[22:56:38] cthulchu: they're not anonymous functions, are they?
[22:56:44] zenspider: different languages are different. expecting one to act like another is a recipe for disaster
[22:57:23] schneider: has joined #ruby
[22:57:27] zenspider: you need to unlearn your JS to properly learn ruby
[22:57:35] cthulchu: I'm gonna finish this piece and show you to get some constructive criticism
[22:57:39] apeiros: array.select { |x| x > 2 } # ruby
[22:57:45] apeiros: array.filter(function(x) { return x > 2 }) # js
[22:57:47] apeiros: ruby wins :)
[22:57:52] apeiros: unless you use ES6 syntax
[22:57:55] cthulchu: well not quite
[22:58:01] cthulchu: I'll show you what I did
[22:58:38] jrich523: i do agree with you on that one, ruby is way better than JS :D
[22:59:04] apeiros: and in ruby, almost everything which has each also includes Enumerable. JS is a lot worse there.
[22:59:23] apeiros: ACTION remembers Array.from(document.querySelectorAll(cssExpression)).filter(…)
[22:59:34] apeiros: because of course, NodeList does not implement filter.
[22:59:51] apeiros: (querySelectorAll returns a NodeList)
[23:01:26] cthulchu: ok, please take a look at this: https://paste.ofcode.org/zuRDgGBwEuk2cDfAebJ6vS
[23:01:37] jrich523: ruby bother me with its excessive ways of doing things.. however... i dont find anything "wrong" with it... JS just makes me angry to code... like... omg did we really need to turn this horrible/light script lang in to something so extensive?
[23:02:09] jrich523: puts is probably angry about the ()
[23:02:11] cthulchu: I feel the same
[23:02:15] jrich523: does get_driver() need the ()?
[23:02:31] cthulchu: in JS you get the function intself if you don't use ()
[23:02:35] cthulchu: () is the envoker
[23:02:41] cthulchu: very comfortable
[23:02:42] jrich523: i like to use the interperted string stuff #{} vs +
[23:02:54] GodFather: has joined #ruby
[23:02:58] cthulchu: I would appreciate {} instead of def ends and in ifs too
[23:02:59] jrich523: thats most languages... and honestly, i like the use of () on methods
[23:03:09] jrich523: i think you CAN do that
[23:03:14] cthulchu: not with defs
[23:03:21] cthulchu: maybe with ifs
[23:03:28] cthulchu: can we use {} with ifs?
[23:03:33] apeiros: only do/end (blocks) can use {}
[23:03:43] apeiros: as said earlier btw. ;-)
[23:03:58] jrich523: yes, and now that yo usay it, i do recall it
[23:04:10] jrich523: so many little details, trying to pack them in as best as possible :)
[23:04:47] jrich523: oh, line 24
[23:04:53] jrich523: i bet a linter would be grumpy
[23:05:03] jrich523: .nil? it would likely want?
[23:05:14] apeiros: cthulchu: note that `puts ("foo")`, ruby does not interpret the parens to mean "delimits arguments"
[23:05:36] apeiros: it considers puts an unparenthesized method which has an argument `("foo")`
[23:05:57] karapetyan: has joined #ruby
[23:06:29] cthulchu: I just use them with all methods
[23:06:37] schneider: has joined #ruby
[23:06:39] apeiros: you don't understand
[23:06:45] jrich523: so you could get nutty and do: method ('p1') 'p2'
[23:06:52] apeiros: well, maybe showing you why it matters will make you understand:
[23:06:55] apeiros: >> def foo(x); "hi #{x}"; end; foo ("ho").upcase
[23:07:10] apeiros: eval-in dead or ruboto slow? o0
[23:07:12] lxsameer: has joined #ruby
[23:07:18] jrich523: ACTION pokes bot 
[23:07:24] cthulchu: you didn't end it
[23:07:31] apeiros: ok, ruboto dead…
[23:07:32] cthulchu: ah, no, you did
[23:07:52] cthulchu: why do you have semicolons?
[23:08:00] cthulchu: ah, they replace newlines
[23:08:30] ruby[bot]: has joined #ruby
[23:08:30] ChanServ: +o ruby[bot]
[23:08:34] apeiros: >> def foo(x); "hi #{x}"; end; foo ("ho").upcase
[23:08:44] jrich523: i guess that works as i would expect
[23:08:51] ruby[bot]: apeiros: # => "hi HO" (https://eval.in/1021708)
[23:08:56] apeiros: >> def foo(x); "hi #{x}"; end; foo("ho").upcase
[23:08:58] ruby[bot]: apeiros: # => "HI HO" (https://eval.in/1021709)
[23:09:05] apeiros: jrich523: really?
[23:09:09] jrich523: like, as in, i expect it to upper case the HO
[23:09:11] cthulchu: I thought so too
[23:09:12] apeiros: did you expect "hi HO" and not "HI HO"?
[23:09:16] jrich523: powershell is a little... funky.. with () too
[23:09:25] cthulchu: I expected hi HO
[23:09:33] jrich523: i expected, and got, hi HO
[23:09:34] cthulchu: actually no
[23:09:43] cthulchu: it should be HI HO
[23:09:53] apeiros: you get HI HO (and should expect it) if the parens delimit arguments
[23:10:09] apeiros: and that's what I'm telling you. if you put a space in front, it does *not* delimit arguments.
[23:10:15] jrich523: i had to modify it due to a shell change
[23:10:20] jrich523: i had to slap a puts in the method
[23:10:23] jrich523: because, echo is off
[23:10:33] jrich523: and i forget the toggle method it had me create to switch it
[23:10:50] apeiros: in `foo("bar")`, `"bar"` is the argument. in `foo ("bar")`, `("bar")` is the argument
[23:10:56] cthulchu: >> def foo(x); "hi #{x}"; end; (foo("ho")).upcase
[23:10:57] ruby[bot]: cthulchu: # => "HI HO" (https://eval.in/1021710)
[23:11:30] apeiros: yes, of course, you can always make everything entirely unambiguous by adding more parens :) it also becomes more noisy
[23:11:43] cthulchu: how would you do it?
[23:11:48] cthulchu: I don't see any other way
[23:11:52] apeiros: I'd not put a space before the paren :D
[23:12:02] apeiros: or just not use parens at all with a single argument and no chaining.
[23:12:29] apeiros: `puts "hi"` is fine. `puts("hi")` is fine, even though it is a bit noisy. and `puts ("hi")` is almost always just wrong :)
[23:12:50] cthulchu: >>puts ("hi")
[23:12:51] ruby[bot]: cthulchu: # => hi ...check link for more (https://eval.in/1021711)
[23:12:59] apeiros: it "works".
[23:13:00] cthulchu: >>puts("hi")
[23:13:00] ruby[bot]: cthulchu: # => hi ...check link for more (https://eval.in/1021712)
[23:13:14] cthulchu: yeah, I guess it concatenates a nill?
[23:13:16] apeiros: as said, you'll mostly notice when chaining.
[23:13:25] jrich523: it works, but can have uninteneded consequences
[23:13:28] cthulchu: okay, I understood
[23:13:32] apeiros: no, it does not. it's how I said. it considers the parens part of the argument.
[23:13:48] cthulchu: okay, now I see
[23:13:49] Paraxial: has joined #ruby
[23:13:56] cthulchu: weird that it doesn't throw an exception
[23:14:01] apeiros: *raise ;-p
[23:14:15] apeiros: well, any expression is a valid argument
[23:14:21] apeiros: and expressions may have an arbitrary number of parens
[23:14:31] apeiros: >> puts (((((("wow"))))))
[23:14:31] cajone: has joined #ruby
[23:14:32] ruby[bot]: apeiros: # => wow ...check link for more (https://eval.in/1021713)
[23:15:35] cthulchu: nice syntax adds some interesting complications
[23:15:49] cthulchu: okay, so what about line 24?
[23:15:59] cthulchu: is it a normal usage for what I'm doing?
[23:16:00] schneider: has joined #ruby
[23:16:21] cthulchu: see how it's overcomplicated comparing to normal JS's .forEach()
[23:16:28] jrich523: i think it would tell you to use the if/unless format
[23:16:51] cthulchu: what's lint"
[23:16:58] lxsameer: has joined #ruby
[23:17:29] jrich523: debug.push object unless object[dataLayerVarName].nil?
[23:17:40] jrich523: guess it would want you to do it more like that?
[23:17:59] cthulchu: what is it?
[23:18:11] cthulchu: I don't know what that is
[23:18:32] jrich523: lol didnt we have a huge chat about this, and its rules, and how some think those rules are too much
[23:18:48] cthulchu: probably not with me?
[23:18:59] jrich523: i could have sworn it was with you, yesterday
[23:19:02] jrich523: but i barely remember my name
[23:19:04] jrich523: so who knows
[23:19:21] cthulchu: what is rubocop?
[23:19:23] jrich523: https://github.com/rubocop-hq/rubocop
[23:19:51] cthulchu: interesting
[23:19:53] jrich523: it calls itself a "code analyzer"
[23:19:56] jrich523: which is just a linter
[23:19:59] apeiros: cthulchu: what about line 24?
[23:20:11] cthulchu: is it a way you'd do this?
[23:20:13] jrich523: apeiros do my comments stand about line 24? ^^
[23:20:15] apeiros: I assume still of this? https://paste.ofcode.org/zuRDgGBwEuk2cDfAebJ6vS
[23:20:38] cthulchu: it's different there
[23:20:45] cthulchu: it's line 7
[23:21:11] apeiros: event = dataLayer.select{|object|mainTesterForEach(object,dataLayerVarName,dataLayerVarVal,debug)}
[23:21:43] cthulchu: see how I have a separate function instead of having it here
[23:21:47] cthulchu: anonymously
[23:21:55] cthulchu: I would prefer the anonymous way
[23:22:01] lxsameer: has joined #ruby
[23:22:05] cthulchu: but I'm not sure I could put that in a block
[23:22:15] apeiros: https://paste.ofcode.org/rg2mmV6pHQH7QdQtfWu8mT
[23:22:31] apeiros: I mean the stuff which adds up is your debug code
[23:22:35] cthulchu: wow, you can do << instead?!
[23:22:42] cthulchu: the same thing that concats strings?
[23:22:42] apeiros: sure. << is a valid method name.
[23:22:46] cthulchu: that's cool
[23:22:53] jrich523: thats one area i have yet to dig in to
[23:22:59] apeiros: and as a method, its meaning depends on the receiver (the thing you send the method to)
[23:23:07] jrich523: the assignement stuff << <= etc
[23:23:34] apeiros: and for Array, Array#<< is push, yes.
[23:23:35] cthulchu: should rename it
[23:23:40] zenspider: jrich523: << and <= are just method calls/names. not implying assignment
[23:23:56] jrich523: not sure i follow
[23:24:14] zenspider: myarray << obj is just myarray.<<(obj)
[23:24:17] apeiros: jrich523: `foo << bar` is just nice for `foo.<<(bar)`
[23:24:23] jrich523: sorta like a lambda?
[23:24:26] cthulchu: why no camelCase?
[23:24:30] jrich523: yeah those are all cryptic to me :)
[23:24:37] apeiros: cthulchu: ruby convention is snake_case
[23:24:46] jrich523: i didnt realize there was a method "<<"
[23:24:47] apeiros: and PascalCase for constants
[23:24:54] zenspider: there's only one assignment "=" (and some crafty helpers like +=)
[23:25:05] apeiros: jrich523: a lot of symbolic stuff is actually "just" methods.
[23:25:15] schneider: has joined #ruby
[23:25:18] apeiros: +, -, &, **, ~=
[23:25:22] apeiros: to name a few
[23:25:27] apeiros: [] and []= too
[23:25:30] jrich523: .... those are methods? geesh
[23:25:39] ruby[bot]: apeiros: # => 3 (https://eval.in/1021714)
[23:25:41] cthulchu: []= is cool
[23:25:44] apeiros: >> 1.send(:+, 2)
[23:25:45] ruby[bot]: apeiros: # => 3 (https://eval.in/1021715)
[23:25:50] jrich523: i did read something, in regards to properties and method, that basically made it sound like properties were methods
[23:26:08] zenspider: jrich523: nearly everything in ruby is done via message sends
[23:26:15] zenspider: (method calls)
[23:26:20] apeiros: you can't access an @instance_variable from outside an object. you always have to go through a method.
[23:27:02] apeiros: either by having one of a matching name (attr_* generates those), or by one of a different name, or by introspection via instance_variable_get
[23:27:14] jrich523: and the attr_* map that for you?
[23:27:27] jrich523: create get/set methods for the internal/private member?
[23:27:36] cthulchu: apeiros, in your solution you have two lines in the block. the first one doesn't return anything and the second one does?
[23:27:38] apeiros: i.e., all `attr_accessor :foo` does is write the following code for you: `def foo; @foo; end; def foo=(value); @foo = value; end`
[23:27:40] jrich523: @var is that sort of like a field then?
[23:27:55] apeiros: cthulchu: all lines do. but the last statement matters.
[23:27:55] jrich523: field vs property (C#)
[23:28:20] cthulchu: but still, there are functions that can't be expressed in blocks?
[23:28:25] apeiros: >> def foo; yield; end; foo { 1; 2; 3 }
[23:28:26] ruby[bot]: apeiros: # => 3 (https://eval.in/1021716)
[23:28:36] apeiros: cthulchu: not really.
[23:28:45] cthulchu: so block is a function?
[23:28:51] jrich523: apeiros i appreciate you letting the two of us pick your brain at the same time.. lol thanks :)
[23:28:57] apeiros: it's a bit more than an anonymous function, yes.
[23:29:06] apeiros: it's additionally a closure (but JS does that too)
[23:29:12] cthulchu: oh, very cool
[23:29:20] cthulchu: I like it. okay.
[23:29:47] apeiros: jrich523: I'm not familiar with C# terminology, sorry
[23:29:53] apeiros: and since nuances matter :)
[23:30:04] jrich523: field/property seems to be common in compiled langs
[23:30:07] dogweather: has joined #ruby
[23:30:20] jrich523: fields are internal values, properties ahve get/set that allow you to control how it is pushed to the field
[23:30:25] apeiros: point is: @ivars are internal state. not externally accessible. you have to "grant" access through methods.
[23:30:31] jrich523: properties are almost always backed by fields (not always shown that tho)
[23:30:41] DTZUZO: has joined #ruby
[23:30:49] jrich523: yeah so i think the analogy works..
[23:30:50] apeiros: then yes, that sounds like @ivars match fields
[23:31:04] apeiros: they are probably still different in that @ivars are not allocated when the object is created.
[23:31:15] apeiros: they start to exist on first assignment.
[23:31:22] jrich523: oh man, what about first read?
[23:31:26] apeiros: and if they don't exist, reading them evaluates to nil.
[23:31:30] apeiros: (and causes a warning)
[23:31:41] Azure|dc: has joined #ruby
[23:31:53] cthulchu: will an empty array cast into false?
[23:32:03] apeiros: there's no casting in ruby :)
[23:32:15] cthulchu: well I don't know how to call it
[23:32:21] apeiros: but ruby considers everything except nil/false to be truthy
[23:32:36] cthulchu: then this doesn't make sense: if event
[23:32:36] apeiros: so yes, `if []` will go into the branch
[23:32:48] cthulchu: ok, I'll do the length
[23:32:55] cthulchu: so 0 is true too?>
[23:33:12] apeiros: cthulchu: can event be 'false'?
[23:33:42] cthulchu: I suspect .select will return nil if there's nothing to return
[23:33:44] cthulchu: let me check
[23:33:50] apeiros: `if event != nil` is only different from `if event` if event can be false, and that should be treated differently from nil.
[23:34:05] jrich523: yes it will :(
[23:34:07] apeiros: no, select will return an empty array.
[23:34:07] jrich523: learned that today
[23:34:31] apeiros: but in that case, your event != nil was wrong too :)
[23:34:32] bambanx: has joined #ruby
[23:34:34] schneider: has joined #ruby
[23:34:39] apeiros: so I guess you want: if !event.empty?
[23:34:52] bambanx: has joined #ruby
[23:34:56] cthulchu: I'll rewrite it to do .length
[23:35:30] apeiros: we usually prefer .size in ruby. but Array#length is an alias.
[23:35:42] jrich523: i think size is prefered? i dont know, iread something a couple days back about length/count/size, and it seemed like length was not much loved
[23:36:07] apeiros: count you should usually only use if you use it with an argument or block. else .size.
[23:36:32] jrich523: size was flexible in that array count vs str length are both returned for size, but count only returns array size? something like that?
[23:36:52] apeiros: na, count without arg is also the same as size/length
[23:37:02] apeiros: but count can take an argument, to count specific things in an array.
[23:37:11] apeiros: >> [1,2,3,1,2,1,2,2,3,1].count(1)
[23:37:12] ruby[bot]: apeiros: # => 4 (https://eval.in/1021717)
[23:37:18] lxsameer: has joined #ruby
[23:37:19] apeiros: >> [1,2,3,1,2,1,2,2,3,1].count { |x| x > 1 }
[23:37:20] ruby[bot]: apeiros: # => 6 (https://eval.in/1021718)
[23:37:28] cthulchu: I'm trying to use mot popular method names
[23:37:32] dviola: has joined #ruby
[23:37:36] jrich523: thats pretty spiffy... i might have a place for that :)
[23:37:41] cthulchu: I switch languages rather often
[23:38:10] apeiros: btw., all those things which have to iterate through your collection *usually* come from Enumerable
[23:38:25] cthulchu: it can come from something else?
[23:38:27] apeiros: so if your class has #each, you can include Enumerable and get all those nice methods for free.
[23:38:32] cthulchu: ah, I guess datastructures
[23:38:52] apeiros: Array defines its own variants for some, because it can do it more efficiently.
[23:39:19] apeiros: Hash defines its own variants for select/reject, so they return a Hash instead of an Array
[23:43:04] jrich523: well, i think i'll call it a day.. apeiros and zenspider apprecaite the time and info!
[23:43:40] cthulchu: most text editors don't highlight ends
[23:43:54] schneider: has joined #ruby
[23:44:03] cthulchu: I hope they get rid of this nonsense and switch to {}
[23:44:23] cthulchu: or to python's block syntax
[23:44:24] apeiros: oooor you could switch to a decent editor :-p
[23:44:38] apeiros: at least in sublime, I can even fold those things
[23:45:00] cthulchu: errr... I can fold defs
[23:45:45] cthulchu: weird... I can fold if-elses too
[23:45:50] cthulchu: but it doesn't highlight them
[23:46:19] apeiros: get a better theme then?
[23:47:21] cthulchu: if doesn't need an end when there's else?
[23:48:08] apeiros: what do you mean?
[23:48:28] cthulchu: if else end
[23:49:08] apeiros: I don't follow :(
[23:51:15] zenspider: apeiros: they want to code in python... maybe they should
[23:52:01] lxsameer: has joined #ruby
[23:52:12] cthulchu: oh this is beautiful
[23:52:31] cthulchu: I injected Analytics tests in our QA's testing framework
[23:52:43] cthulchu: they automate Selenium with Ruby
[23:53:07] cthulchu: wanted to do it for a while now
[23:53:29] schneider: has joined #ruby
[23:54:15] bobdobbs: has joined #ruby
[23:57:00] weird_error: has joined #ruby
[23:59:24] roamingdog: has joined #ruby