« Back to channel list

#ruby - 09 April 2019

« Back 1 day Forward 1 day »
[00:05:17] nuh^: has joined #ruby
[00:09:42] galaxie: has joined #ruby
[00:15:12] _whitelogger: has joined #ruby
[00:24:04] Swyper: has joined #ruby
[00:27:20] yield: has joined #ruby
[00:31:38] jottr: has joined #ruby
[00:33:54] segy: has joined #ruby
[00:42:03] i1nfusion: has joined #ruby
[00:44:30] jenrzzz: has joined #ruby
[00:45:06] AJA4350: has joined #ruby
[00:46:56] Swyper: has joined #ruby
[00:54:01] yield: has joined #ruby
[00:58:36] Swyper: has joined #ruby
[01:04:24] Swyper: has joined #ruby
[01:24:07] mozzarella: has joined #ruby
[01:27:06] Nicmavr: has joined #ruby
[01:28:12] mangold: has joined #ruby
[01:40:30] doodlebug: has joined #ruby
[01:41:56] Swyper: has joined #ruby
[01:47:21] segy: has joined #ruby
[01:51:11] _whitelogger: has joined #ruby
[01:54:50] GodFather: has joined #ruby
[02:03:18] Swyper: has joined #ruby
[02:05:39] w0lver1n3: has joined #ruby
[02:08:30] bambanx: has joined #ruby
[02:09:53] mangold: has joined #ruby
[02:12:12] Azure: has joined #ruby
[02:27:11] _whitelogger: has joined #ruby
[02:32:35] Frem: has joined #ruby
[02:33:04] jottr: has joined #ruby
[02:39:24] LtHummus: has joined #ruby
[02:43:49] yield: has joined #ruby
[02:46:57] Swyper: has joined #ruby
[02:51:37] segy: has joined #ruby
[03:00:18] kent\n: has joined #ruby
[03:03:15] jenrzzz: has joined #ruby
[03:09:15] braincrash: has joined #ruby
[03:10:17] gix-: has joined #ruby
[03:17:29] wallace_mu: has joined #ruby
[03:18:01] Swyper: has joined #ruby
[03:19:31] wallace_mu: Guys, is cache log in rails log file for redis cache or memcache log how do i tell?
[03:20:04] wallace_mu: oops wrong room
[03:25:14] Swyper: has joined #ruby
[03:27:35] t0xik: has joined #ruby
[03:34:46] wallace__: has joined #ruby
[03:38:48] Swyper: has joined #ruby
[03:42:08] yield: has joined #ruby
[03:54:11] Swyper: has joined #ruby
[04:00:01] Mia: has joined #ruby
[04:00:02] Mia: has joined #ruby
[04:01:52] kapil____: has joined #ruby
[04:03:31] Swyper: has joined #ruby
[04:04:14] segy: has joined #ruby
[04:04:39] LtHummus: has joined #ruby
[04:08:51] Ai9zO5AP: has joined #ruby
[04:11:22] Tharbakim: has joined #ruby
[04:11:23] Tharbakim: has joined #ruby
[04:20:29] Swyper: has joined #ruby
[04:24:49] agrecascino: has joined #ruby
[04:34:17] jottr: has joined #ruby
[04:35:19] mhlei: has joined #ruby
[04:39:23] i1nfusion: has joined #ruby
[04:49:59] segy: has joined #ruby
[04:50:18] aupadhye: has joined #ruby
[04:58:15] rindolf: has joined #ruby
[05:05:14] jottr: has joined #ruby
[05:06:54] Swyper: has joined #ruby
[05:08:54] sidx64: has joined #ruby
[05:13:57] elomatreb: has joined #ruby
[05:13:59] Fusl: has joined #ruby
[05:17:29] ricekrispie: has joined #ruby
[05:19:19] segy: has joined #ruby
[05:19:41] DmitryBochkarev: has joined #ruby
[05:23:18] conta: has joined #ruby
[05:31:59] mhlei: has joined #ruby
[05:39:10] jottr: has joined #ruby
[05:39:43] sauvin: has joined #ruby
[05:45:21] jottr: has joined #ruby
[05:47:57] jenrzzz: has joined #ruby
[06:01:12] stoffus: has joined #ruby
[06:11:52] ur5us: has joined #ruby
[06:13:11] hightower3: has joined #ruby
[06:16:17] hightower3: has joined #ruby
[06:16:40] salasrod: has joined #ruby
[06:17:43] jottr: has joined #ruby
[06:23:16] schleppel: has joined #ruby
[06:23:34] cschneid: has joined #ruby
[06:23:48] suukim: has joined #ruby
[06:29:13] snickers: has joined #ruby
[06:32:33] aupadhye: has joined #ruby
[06:45:43] clemens3: has joined #ruby
[06:47:58] reber: has joined #ruby
[06:49:01] andikr: has joined #ruby
[06:54:55] jinie: has joined #ruby
[06:55:56] cschneid: has joined #ruby
[07:00:39] jottr: has joined #ruby
[07:00:56] DTZUZO: has joined #ruby
[07:03:25] ellcs1: has joined #ruby
[07:05:50] waheedi: has joined #ruby
[07:07:34] nowhere_man: has joined #ruby
[07:09:03] mhlei: hello. can a instance method visit its member variable without the prefix @? while the member variable is declared as @name
[07:09:13] TomyWork: has joined #ruby
[07:11:58] cschneid: has joined #ruby
[07:12:45] sidx64_: has joined #ruby
[07:13:20] helpa: has joined #ruby
[07:14:20] Hobbyboy|BNC: has joined #ruby
[07:14:34] darkphnx480: has joined #ruby
[07:14:38] ytti: mhlei, no, but if youhave attr_reader getter method is created for you, in which case, yes
[07:14:57] fmccann_: has joined #ruby
[07:15:05] ytti: 'member variable' is a term which i had to guess what you mean, as it's not term relevant to ruby
[07:15:40] dust_: has joined #ruby
[07:16:04] sidx64: has joined #ruby
[07:17:01] haylon: has joined #ruby
[07:17:19] harmaahylje: has joined #ruby
[07:17:25] rprimus: has joined #ruby
[07:18:02] dostoyevsky: has joined #ruby
[07:18:05] tris: has joined #ruby
[07:18:16] Prira: has joined #ruby
[07:18:25] Mon_Ouie: has joined #ruby
[07:21:16] infernix: has joined #ruby
[07:22:42] prestorium: has joined #ruby
[07:23:04] cgfbee: has joined #ruby
[07:27:28] za1b1tsu: has joined #ruby
[07:27:34] alem0lars: has joined #ruby
[07:31:12] za1b1tsu_: has joined #ruby
[07:32:02] jottr: has joined #ruby
[07:32:39] paraxial85: has joined #ruby
[07:32:51] cschneid: has joined #ruby
[07:41:44] mhlei: thank you. ytti.
[07:44:04] cschneid: has joined #ruby
[07:48:17] jenrzzz: has joined #ruby
[07:52:02] cschneid: has joined #ruby
[07:52:25] RiPuk: has joined #ruby
[07:56:22] mhlei: ytti. how do you think the variable `query` in 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/project_search_results.rb#L116'. it's not the getter variable.
[07:56:54] themsay: has joined #ruby
[07:57:11] DarthGandalf: has joined #ruby
[07:57:51] mhlei: it is just the augument of the initialize method.
[07:59:10] arand: has joined #ruby
[07:59:43] kapil____: has joined #ruby
[08:00:41] SanguineAnomaly: has joined #ruby
[08:02:12] mhlei: has joined #ruby
[08:02:15] ytti: mhlei, did you check the parent class, perhaps it implementes query method?
[08:03:30] cschneid: has joined #ruby
[08:03:52] ytti: mhlei, https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/search_results.rb#L5 - here you go
[08:03:54] ur5us: has joined #ruby
[08:04:17] mhlei: oh, you are right. it really has .
[08:10:34] i1nfusion: has joined #ruby
[08:15:22] cschneid: has joined #ruby
[08:19:12] claudiuinberlin: has joined #ruby
[08:26:10] kyrylo: has joined #ruby
[08:28:24] sidx64: has joined #ruby
[08:34:57] D9: has joined #ruby
[08:40:42] esrse: has joined #ruby
[08:58:14] moei: has joined #ruby
[09:01:10] interruptinuse: has left #ruby: ()
[09:08:20] cschneid: has joined #ruby
[09:08:39] i1nfusion: has joined #ruby
[09:12:42] alem0lars: has joined #ruby
[09:16:33] i1nfusion: has joined #ruby
[09:18:17] nowhereman: has joined #ruby
[09:21:09] i1nfusion: has joined #ruby
[09:33:47] yield: has joined #ruby
[09:35:24] LtHummus: has joined #ruby
[09:37:20] jottr: has joined #ruby
[09:38:36] yield: has joined #ruby
[09:40:35] doodlebug: has joined #ruby
[09:41:12] ur5us: has joined #ruby
[09:45:03] sidx64: has joined #ruby
[09:48:37] jenrzzz: has joined #ruby
[09:52:22] mangold: has joined #ruby
[09:54:35] sidx64: has joined #ruby
[09:54:50] lxsameer: has joined #ruby
[09:59:06] TvL2386: has joined #ruby
[10:10:06] moei: has joined #ruby
[10:13:14] queip: has joined #ruby
[10:19:00] Swyper: has joined #ruby
[10:23:33] KeyJoo: has joined #ruby
[10:26:29] conta: has joined #ruby
[10:40:22] Swyper: has joined #ruby
[10:41:24] Fusl: has joined #ruby
[10:45:22] jenrzzz: has joined #ruby
[10:49:23] mikker: has joined #ruby
[10:49:28] HendrikPeter: has joined #ruby
[10:56:03] cschneid: has joined #ruby
[11:04:59] sidx64: has joined #ruby
[11:10:35] doodleb10: has joined #ruby
[11:17:08] mat_bug: has joined #ruby
[11:20:12] Swyper: has joined #ruby
[11:22:03] sidx64: has joined #ruby
[11:22:40] d^sh: has joined #ruby
[11:27:22] sidx64: has joined #ruby
[11:28:35] doodlebug: has joined #ruby
[11:29:11] Hanmac1: has joined #ruby
[11:30:11] apparition: has joined #ruby
[11:31:05] bokwoon: has joined #ruby
[11:42:46] AJA4350: has joined #ruby
[11:45:07] ldnunes: has joined #ruby
[11:49:03] mhlei: has joined #ruby
[11:54:01] Blaguvest: has joined #ruby
[11:54:15] Some-body_: has joined #ruby
[11:55:15] nowhereman: has joined #ruby
[11:59:30] RedSnarf: has joined #ruby
[12:07:16] Nicmavr: has joined #ruby
[12:12:42] danielsju6: has joined #ruby
[12:12:58] vondruch: has joined #ruby
[12:18:29] sidx64: has joined #ruby
[12:31:42] cschneid: has joined #ruby
[12:34:20] ogurk_: has joined #ruby
[12:34:39] jottr: has joined #ruby
[12:37:53] ogurk_: is rubygems using OS certs for accessing rubygems? I'm proxy rubygems via artifatory that's fronted with internal certs. While trying to install gem I'm getting ssl verify error.
[12:38:39] ogurk_: internal ca is added locally - but apparently not used
[12:40:21] ferr: has joined #ruby
[12:45:05] apg: has joined #ruby
[12:45:05] apg: has joined #ruby
[12:45:42] jenrzzz: has joined #ruby
[12:51:56] jottr: has joined #ruby
[12:55:34] stryek: has joined #ruby
[13:00:30] AndroidKitKat: has joined #ruby
[13:02:21] ujjain: has joined #ruby
[13:02:22] ujjain: has joined #ruby
[13:03:18] s3nd1v0g1us: has joined #ruby
[13:04:22] AndroidKitKat: has joined #ruby
[13:08:26] mondz: has joined #ruby
[13:08:38] AndroidKitKat: has joined #ruby
[13:09:39] andikr: has joined #ruby
[13:10:19] jottr: has joined #ruby
[13:16:08] lucasb: has joined #ruby
[13:21:27] jottr: has joined #ruby
[13:21:41] Bish: someone having tried attaching files with the mailg em?
[13:21:57] Bish: i tried mail["test.csv"] = content_of_file
[13:22:09] Bish: and its also appended in the mail, but the client doesnt show theres a file attached
[13:22:57] Bish: while gmail does :o
[13:29:29] bokwoon: has joined #ruby
[13:34:14] wallace_mu: has joined #ruby
[13:39:14] Bish: Content-Type: text/csv;\r\n charset=UTF-8;\r\n filename=lol.csv
[13:39:27] Bish: it seems to add newslines in a content section of a field
[13:39:47] Bish: (m=Mail.new).attachments["lol.csv"] = "test";p m.to_s
[13:39:49] Bish: can anyone confirm?
[13:39:53] Bish: >> require 'mail'
[13:40:03] Bish: &> require 'mail'
[13:40:04] rubydoc: parser error at position 0 around `>'
[13:42:54] Bish: it's odd, i see the code and it has those thing snot in there
[13:45:25] adam12: Bish: Not super familiar with the Mail gem directly (usually use it through Roda) but have you looked at the `add_file` method?
[13:47:36] Bish: does it the same way, as it seems
[13:52:14] adam12: Bish: Not sure if it helps? https://gist.github.com/adam12/f6131e77c7e5bb0e479d7488b7d4adcf
[13:52:43] Bish: as you can see it does the same thing :/ adds \r\n for some reason
[13:52:57] Bish: inside a header value.. while \r\n is used to seperate heder values
[13:53:46] Bish: seems like thunderbbird doesnt like this one
[13:54:27] Bish: can you deliver a mail like that to your thunderbird of your choice?
[13:55:21] samort7: has joined #ruby
[13:56:03] andikr: has joined #ruby
[13:59:19] fluxAeon: has joined #ruby
[14:00:48] krawchyk: has joined #ruby
[14:01:24] beilabs: has joined #ruby
[14:02:42] adam12: Bish: Loads OK here. Thunderbird 60.6.1 (32-bit) Windows.
[14:03:16] Bish: m.parts.first.header.fields.map(&:encoded)
[14:03:21] Bish: this doesnt look correc
[14:03:33] Bish: tContent-Type: text/plain;\r\n charset=UTF-8\r\
[14:04:49] Bish: do you think this is a bug?
[14:05:45] adam12: Bish: The \r\n inside the header?
[14:07:54] Bish: inside the VALUE of the header
[14:08:08] Bish: trying to find out right now, why
[14:08:43] tdy: has joined #ruby
[14:09:32] Bish: m.parts.first.header.fields.map(&:encoded)
[14:10:45] beilabs: has joined #ruby
[14:11:26] cschneid: has joined #ruby
[14:12:02] Bish: ofcourse the "encoded" method is nowhere to be found
[14:15:36] Bish: i hate that gem
[14:15:44] Bish: it works much better than its code quality suggests
[14:16:48] yield: has joined #ruby
[14:20:48] duderonomy: has joined #ruby
[14:20:51] DmitryBochkarev: has joined #ruby
[14:25:00] za1b1tsu: has joined #ruby
[14:27:58] Bish: there are alooot of issues on attachments with that
[14:28:05] Bish: interesting
[14:29:15] cschneid: has joined #ruby
[14:29:18] Bish: holy shit what is that crap
[14:29:21] Bish: field has an attribute field
[14:29:41] Bish: abstraction.jgp
[14:31:53] Bish: adam12: jeremyevans is the last one committing to that :)
[14:32:38] adam12: Bish: which?
[14:33:32] Bish: https://github.com/mikel/mail/blob/master/lib/mail/fields/content_disposition_field.rb#L36
[14:33:42] Bish: this seems to be the line that does that adding of \r\n
[14:33:47] Bish: it looks pretty intentional?
[14:33:48] Bish: but wrong?
[14:36:51] Bish: i can't find references that want it that way, no clue why he does ti
[14:39:19] Rapture: has joined #ruby
[14:44:32] adam12: Bish: Are you sure this is the issue? Looking at the RFC, "folding" is permitted to break up lines, by using a \r\n\s sequence.
[14:45:10] adam12: (not specifically that sequence but "a CRLF may be inserted before any WSP").
[14:45:20] adam12: Bish: https://tools.ietf.org/html/rfc5322#section-2.2.3
[14:46:07] jenrzzz: has joined #ruby
[14:58:56] galaxie: has joined #ruby
[15:01:13] polishdub: has joined #ruby
[15:01:43] conta: has joined #ruby
[15:05:04] danielz1: has joined #ruby
[15:05:18] Swyper: has joined #ruby
[15:06:41] rippa: has joined #ruby
[15:11:31] danielsju6: has joined #ruby
[15:11:46] Swyper: has joined #ruby
[15:11:57] zachk: has joined #ruby
[15:12:32] Sylario: has joined #ruby
[15:16:45] Dbugger: has joined #ruby
[15:17:36] DmitryBochkarev: has joined #ruby
[15:34:50] Inline: has joined #ruby
[15:34:56] jottr_: has joined #ruby
[15:35:31] UnknownSoldier: has joined #ruby
[15:39:19] vulcan: has joined #ruby
[15:48:39] donofrio: has joined #ruby
[15:52:56] conta2: has joined #ruby
[15:58:21] mondz: has joined #ruby
[15:59:05] mondz: has joined #ruby
[16:00:16] my-nick: has joined #ruby
[16:02:50] eddof13: has joined #ruby
[16:05:51] Swyper: has joined #ruby
[16:09:57] eddof13: has joined #ruby
[16:13:09] Swyper: has joined #ruby
[16:13:44] neovalis0: has joined #ruby
[16:16:13] nowhereman: has joined #ruby
[16:21:35] yield: has joined #ruby
[16:22:29] Swyper: has joined #ruby
[16:27:29] Swyper: has joined #ruby
[16:28:51] jottr: has joined #ruby
[16:30:24] jenrzzz: has joined #ruby
[16:30:49] mondz: has joined #ruby
[16:32:10] brool: has joined #ruby
[16:32:57] wallace_mu: has joined #ruby
[16:34:41] orbyt_: has joined #ruby
[16:36:26] my-nick: has joined #ruby
[16:37:27] hxegon: has joined #ruby
[16:39:23] mondz: has joined #ruby
[16:40:05] jcarl43: has joined #ruby
[16:41:20] orbyt_: has joined #ruby
[16:46:47] hxegon: has joined #ruby
[16:48:18] orbyt_: has joined #ruby
[16:49:10] polishdub: has joined #ruby
[16:58:15] neovalis0: has joined #ruby
[17:03:45] dviola: has joined #ruby
[17:07:37] gix: has joined #ruby
[17:09:38] aqd: has joined #ruby
[17:14:28] neovalis0: has joined #ruby
[17:16:17] dellavg_: has joined #ruby
[17:19:43] yield: has joined #ruby
[17:20:24] hightower3: has joined #ruby
[17:22:05] jenrzzz: has joined #ruby
[17:22:48] waheedi: has joined #ruby
[17:24:17] duderonomy: has joined #ruby
[17:28:10] clemens3: has joined #ruby
[17:39:11] mwlang: has joined #ruby
[17:40:45] mwlang: Typically when I want to not have to do a check if a variable contains an array of values before starting a loop, I’ll do something like Array(foo).each { … } Works fairly well except for when foo is a Hash.
[17:41:58] mwlang: Array({foo: :bar, fiz: :batz}) => l[[:foo, :bar], [:fiz, :batz]] instead of what I was expecting, which would be: [{foo: :bar}]
[17:42:13] hiroaki: has joined #ruby
[17:43:01] mwlang: although I can work around this with conditional, I’m curious as to why Hashes are treated differently by the Array() “cast” method than other types are.
[17:43:38] brool: has joined #ruby
[17:45:55] mwlang: looks like I can get away with not converting Hash variable into arrays themselves by using [foo].flatten.each { … }
[17:47:10] phaul: you haven't told us why you would do this, it really feels xy problem to me
[17:48:28] ytti: i use [var].flatten pattern a lot, when i want method to accept value or list of values
[17:48:42] ytti: but i'm not sure how this applies to hash, because are you then setting they key or value?
[17:48:52] ytti: you have just one variable, how do you create dummy hash out of it?
[17:49:12] ytti: like you can do {}.merge(hash).each
[17:49:19] ytti: but i don't understand where it would make sense
[17:50:23] phaul: [*var] is a bit more succint maybe
[17:50:53] yield: has joined #ruby
[17:51:35] alem0lars: has joined #ruby
[17:53:32] mwlang: well, I am parsing an XML document. if an element appears multiple times, it’s returned as an array…it it appears only once, it’s returned as just that element (not in an array)
[17:54:10] mwlang: so to be “safe” in following nested sections, I want to cast to Array so I always “have an array” and then loop to go deeper in the nest.
[17:55:11] phaul: and if you get a hash that's just one element?
[17:55:37] Xiti: has joined #ruby
[17:55:57] phaul: [elem].flatten as ytti said or [*elem] as I said, whichever you like more
[17:56:12] mwlang: so [foo] on an array gives me [[foo]] while [foo] on hash gives me [foo]. Thus the flatten call to keep things unchange.
[17:57:02] cloaked1: has joined #ruby
[17:57:02] cloaked1: has joined #ruby
[17:57:05] mwlang: right. I already came to that conclusion. I’m just wondering about the reasoning behind ruby treating hashes differently with the Array cast.
[17:57:25] mwlang: seems to violate principle of least surprise, at least for me.
[17:57:52] phaul: the OO aproach would be to return [] or at least the same type from xml parsing
[17:58:27] mwlang: I agree with you on that. but I didn’t write the XML => hash parser, so I’m regularizing it after the fact.
[17:58:43] havenwood: mwlang: Ruby is the principle of least surprise for Matz, just Matz.
[17:59:30] mwlang: LOL — then he and I think too much alike…:-p
[17:59:46] havenwood: mwlang: The idea is that it's more useful generally to have Hashes destructure into pairs with #to_a, so you can move between Hash and Array.
[17:59:58] havenwood: &>> {aim: true}.to_a.to_h
[18:00:01] rubydoc: # => {:aim=>true} (https://carc.in/#/r/6p2e)
[18:00:41] mwlang: ah-ha. Now that makes sense to me from the design perspective.
[18:00:45] sidx64: has joined #ruby
[18:01:06] mwlang: it’s rare that I go between arrays and hashes
[18:01:23] havenwood: &>> class Hash; def to_ary; [self] end end; Array.new({aim: true})
[18:01:24] rubydoc: # => [{:aim=>true}] (https://carc.in/#/r/6p2f)
[18:02:06] mwlang: except looping over key/value pairs of a flat hash, but that’s pretty much part of the Ruby syntax magic there.
[18:03:11] havenwood: mwlang: Kernel::Array uses #to_ary over #to_a if it's defined, so you can change its behavior by implementing #to_ary.
[18:03:22] orbyt_: has joined #ruby
[18:03:57] havenwood: mwlang: But yeah, Hashes have a bit of an odd #to_a, so they can go to Arrays and back since Enumerable only uses Array as the reducing object.
[18:04:05] mwlang: Nice way to do that.
[18:06:09] mwlang: I only have one place in the code (so far) where I’m dealing with coercing a Hash variable into an array of Hash variables for all depths of processing elements in the XML, so getting fancy isn’t really called for here. But definitely a great tip to keep in mind for future.
[18:06:32] duderonomy: has joined #ruby
[18:06:42] yield: has joined #ruby
[18:06:52] sidx64_: has joined #ruby
[18:07:00] kujira: has joined #ruby
[18:07:22] postmodern: has joined #ruby
[18:08:41] mwlang: speaking of looping hashes, has it always been possible to do this? {foo: 1, bar:2}.map {|k,v| puts [k,v].join(' => ')} => “foo => 1\nbar => 2”
[18:09:10] mwlang: I mean, using #map and #each and having both key and value in the loop
[18:09:14] conta: has joined #ruby
[18:09:41] mwlang: I used to use #each_pair for that, but at some point, I forgot the “_pair” when writing a loop and it worked.
[18:09:52] cd: has joined #ruby
[18:10:04] mwlang: made me wonder if I learnt wrongly in the beginning or if this capability came along after Ruby 1.8.6
[18:10:42] phaul: &20>> {a:1}.map {|k,v| "#{k} => #{v}" }
[18:10:43] rubydoc: # => ["a => 1"] (https://carc.in/#/r/6p2g)
[18:10:50] phaul: 2.0 has it
[18:13:06] cd: has joined #ruby
[18:13:54] phaul: so does 1.8 https://eval.in/1093419
[18:14:12] r29v: has joined #ruby
[18:15:40] HendrikPeter: has joined #ruby
[18:16:14] phaul: but that's 1.8.7 and you are asking 1.8.6 , so donno
[18:16:16] Fusl: has joined #ruby
[18:16:51] doodlebug: has joined #ruby
[18:22:26] mwlang: I did a little digging. I think it has always had ability to return two variables with Hash#each and Hash#each_pair made it clear two variables were passed, so I learned #each_pair for iterating hash keys way early on.
[18:23:17] mwlang: I’m sure back then I didn’t know that if I provided two variables, Ruby would intelligently assign individual variables.
[18:23:18] syndikate: In this example, the array inside gets created and destroyed each time the method is called, right? Is the reason being going out of scope?
[18:23:21] syndikate: https://hastebin.com/zelivamaxi.rb
[18:24:27] mwlang: @syndikate pretty sure that’s the case.
[18:24:53] syndikate: Ah okay, it would be the same in any language right?
[18:25:08] havenwood: syndikate: To prevent multiple Arrays, set that as a Constant - and for extra credit, freeze it.
[18:25:10] mwlang: depends on the language for sure.
[18:25:24] havenwood: syndikate: FRUIT = %w[apple mango].freeze
[18:25:46] havenwood: syndikate: Then in the method, just: FRUIT.include?(fruit)
[18:26:20] havenwood: syndikate: And add a frozen string literal for the String freezing
[18:26:43] syndikate: Thanks, yeah, that's what I do havenwood, but that habit came to me from somewhere and was there without me thinking. So, I was just thinking about this now. I was curious for any language that would destroy objects after scope, this would be the same, right?
[18:27:10] duderonomy: has joined #ruby
[18:27:27] phaul: a language potentially could discover that that's constant data and optimize it out
[18:27:28] mwlang: @syndikate some languages that byte-compile may optimize away the array destruction on out of scope.
[18:27:50] havenwood: syndikate: Even a Ruby implementation like TruffleRuby might be able to optimize that away as well
[18:28:07] jtdowney: has joined #ruby
[18:28:31] syndikate: havenwood, Any string that is being used in a class I usually make it constant and freeze, and some arrays too.
[18:28:31] syndikate: Oh, okay. What languages are there such?
[18:28:37] mwlang: oh, gosh…I haven’t even thought about the variants other than MRI ruby as an option in years.
[18:29:16] mwlang: @syndikate python, crystal, java
[18:30:41] mwlang: personally, I’d do what havenwood suggests just because having “magic” numbers and constants other than 0, 1, nil inside the methods is poor practice.
[18:31:08] syndikate: Oh python does that ? :O
[18:31:47] jtdowney: has joined #ruby
[18:32:27] Bish: adam12: okay, thanks :o
[18:33:16] havenwood: syndikate: maybe PyPy?
[18:34:54] mwlang: you’ll have to go ask the python experts, but I do know python pre-compiles pretty aggressively so it has strong potential to optimize static variables inside methods.
[18:35:03] syndikate: I didn't know it has such optimisations while ruby doesn't
[18:35:22] mwlang: two very different beasts
[18:35:27] duderonomy: has joined #ruby
[18:37:15] jtdowney: has joined #ruby
[18:37:35] yield: has joined #ruby
[18:37:39] ruby-lang136: has joined #ruby
[18:44:32] Fira: has joined #ruby
[18:45:08] ellcs: has joined #ruby
[18:45:58] syndikate: Ah well something new for today
[18:46:52] doodleb4: has joined #ruby
[18:49:27] duderonomy: has joined #ruby
[18:55:30] orbyt_: has joined #ruby
[18:59:43] IGnorAND: def initialize(list_type: "ALL", search_term: , page: 1, page_size: 20, sort_by:) <- does this force one to specify a search_term? Or is it optional?
[19:01:30] code_zombie: has joined #ruby
[19:03:45] mwlang: @IGnorAND must specify…same for sort_by.
[19:04:10] mwlang: the rest of the parameters are optional since you provided defaults.
[19:05:12] mwlang: if you want everything optional…then use nil… (list_type: "ALL", search_term: nil, page: 1, page_size: 20, sort_by: nil)
[19:05:49] r3m: has joined #ruby
[19:06:37] Swyper: has joined #ruby
[19:08:28] yield: has joined #ruby
[19:09:45] Rapture: has joined #ruby
[19:10:50] duderonomy: has joined #ruby
[19:18:38] Swyper: has joined #ruby
[19:21:07] segy: has joined #ruby
[19:28:07] neovalis0: has joined #ruby
[19:28:17] Pablo[m]: has joined #ruby
[19:34:10] Iarfen: has joined #ruby
[19:34:38] Pablo[m]: has left #ruby: ("User left")
[19:34:39] Iarfen: how I can use byebug? I'm trying to use it with rails but I don't understand where the console appears
[19:35:49] lxsameer: has joined #ruby
[19:39:21] yield: has joined #ruby
[19:41:41] miah: Iarfen: somewhere in your code, near the area you want to debug you need to add 'byebug' when ruby hits that method the console appears. its going to be in the same terminal as you started your application from.
[19:42:11] miah: https://github.com/deivid-rodriguez/byebug#from-within-the-ruby-code
[19:43:54] yoshida: has joined #ruby
[19:44:28] Swyper: has joined #ruby
[19:52:19] CustosLimen: has left #ruby: ()
[19:53:51] segy: has joined #ruby
[19:54:40] havenwood: Iarfen: Or you can use Pry with ByeBug: https://gist.github.com/palkan/d89757a90cfbeb047c63
[19:55:01] havenwood: (with the pry-rails and pry-byebug gems)
[19:59:40] eddof13: has joined #ruby
[20:00:03] kyrylo: has joined #ruby
[20:01:26] ellcs: has joined #ruby
[20:02:09] Swyper: has joined #ruby
[20:02:20] claudiuinberlin: has joined #ruby
[20:07:05] jenrzzz: has joined #ruby
[20:09:18] HendrikPeter: has joined #ruby
[20:10:12] yield: has joined #ruby
[20:11:45] Semtex-H: has joined #ruby
[20:14:11] t0xik: has joined #ruby
[20:16:52] doodlebug: has joined #ruby
[20:18:20] skarlso: has joined #ruby
[20:18:58] wndxlori: has joined #ruby
[20:21:34] skarlso: has joined #ruby
[20:22:52] doodlebug: has joined #ruby
[20:22:56] eddof13: has joined #ruby
[20:25:31] segy: has joined #ruby
[20:26:25] jenrzzz: has joined #ruby
[20:31:03] HendrikPeter: has joined #ruby
[20:34:42] Swyper: has joined #ruby
[20:35:08] hxegon: has left #ruby: ("Using Circe, the loveliest of all IRC clients")
[20:35:32] hxegon: has joined #ruby
[20:35:33] skarlso: has joined #ruby
[20:36:41] yield: has joined #ruby
[20:36:58] skarlso: has joined #ruby
[20:37:22] lucasb: has joined #ruby
[20:37:53] hxegon: has left #ruby: ()
[20:38:17] hxegon: has joined #ruby
[20:39:19] orbyt_: has joined #ruby
[20:42:18] skarlso: has joined #ruby
[20:43:37] AJA4351: has joined #ruby
[20:47:16] HendrikPeter: has joined #ruby
[20:47:28] orbyt_: has joined #ruby
[20:48:32] Swyper: has joined #ruby
[20:50:03] RiPuk: has joined #ruby
[20:51:13] hightower2: has joined #ruby
[20:54:05] claudiuinberlin: has joined #ruby
[20:54:24] skarlso: has joined #ruby
[20:55:08] Swyper: has joined #ruby
[20:57:01] segy: has joined #ruby
[20:57:43] RiPuk: has joined #ruby
[21:03:17] jottr: has joined #ruby
[21:04:34] nuh^: has joined #ruby
[21:04:48] nuh^: has joined #ruby
[21:05:03] nuh^: has joined #ruby
[21:05:17] nuh^: has joined #ruby
[21:05:31] nuh^: has joined #ruby
[21:05:34] themsay: has joined #ruby
[21:05:45] nuh^: has joined #ruby
[21:10:10] themsay: has joined #ruby
[21:10:10] duderonomy: has joined #ruby
[21:16:09] ur5us: has joined #ruby
[21:22:33] yield: has joined #ruby
[21:22:40] claudiuinberlin: has joined #ruby
[21:24:12] UnknownSoldier: has joined #ruby
[21:28:22] brool: has joined #ruby
[21:34:33] RiPuk: has joined #ruby
[21:38:44] n13z: has joined #ruby
[21:40:08] jottr: has joined #ruby
[21:43:08] skryking: has joined #ruby
[21:44:34] mangold: has joined #ruby
[21:44:49] TheBloke: has joined #ruby
[21:45:13] SeepingN: has joined #ruby
[21:47:20] tdy: has joined #ruby
[21:50:05] RiPuk: has joined #ruby
[21:53:24] RiPuk_: has joined #ruby
[21:53:26] yield: has joined #ruby
[21:53:49] Swyper: has joined #ruby
[21:58:59] lxsameer: has joined #ruby
[22:00:05] jenrzzz: has joined #ruby
[22:10:31] Alison`: has joined #ruby
[22:11:47] s3nd1v0g1us: has joined #ruby
[22:13:39] lord4163: has joined #ruby
[22:14:33] Fernando-Basso: has joined #ruby
[22:18:48] neovalis1: has joined #ruby
[22:19:16] eddof13: has joined #ruby
[22:19:25] shansen: has joined #ruby
[22:20:00] doodlebug: has joined #ruby
[22:21:22] nwradio8788879: has joined #ruby
[22:24:12] Vircung: has joined #ruby
[22:24:19] yield: has joined #ruby
[22:25:59] doodleb14: has joined #ruby
[22:28:09] clemens3_: has joined #ruby
[22:31:54] hxegon: has joined #ruby
[22:37:06] orbyt_: has joined #ruby
[22:38:39] jottr: has joined #ruby
[22:39:02] Alison`: has joined #ruby
[22:43:58] doodleb57: has joined #ruby
[22:47:01] Nicmavr: has joined #ruby
[22:50:51] yield: has joined #ruby
[22:54:27] jcalla: has joined #ruby
[23:01:12] duderonomy: has joined #ruby
[23:01:54] Swyper: has joined #ruby
[23:02:43] mangold: has joined #ruby
[23:07:58] doodlebug: has joined #ruby
[23:18:34] dostoyevsky: has joined #ruby
[23:21:14] duderonomy: has joined #ruby
[23:34:07] ramfjord: has joined #ruby
[23:43:58] bambanx: has joined #ruby
[23:49:31] t0xik: has joined #ruby
[23:51:41] yield: has joined #ruby