« Back to channel list

#ruby - 24 December 2018

« Back 1 day Forward 1 day »
[00:01:16] sticaz: has joined #ruby
[00:02:51] nocoda: has joined #ruby
[00:06:15] cschneid: has joined #ruby
[00:24:23] donofrio: has joined #ruby
[00:31:24] donofrio: has joined #ruby
[00:37:39] cschneid: has joined #ruby
[00:47:51] sarink: has joined #ruby
[00:55:24] hutch: has joined #ruby
[01:02:54] tdy: has joined #ruby
[01:31:47] RougeR: has joined #ruby
[01:43:17] donofrio: has joined #ruby
[01:47:44] tdy: has joined #ruby
[02:05:09] donofrio: has joined #ruby
[02:24:10] _whitelogger: has joined #ruby
[02:27:53] cnsvc: has joined #ruby
[02:27:54] Arkantos: has joined #ruby
[02:37:36] orbyt_: has joined #ruby
[02:48:41] kapil____: has joined #ruby
[02:53:25] PolymorphicProdu: has joined #ruby
[02:56:58] donofrio: has joined #ruby
[03:02:08] tdy: has joined #ruby
[03:05:46] Junaos: has joined #ruby
[03:08:11] cschneid: has joined #ruby
[03:12:35] Junaos: has joined #ruby
[03:14:47] elphe: has joined #ruby
[03:19:32] clemens3: has joined #ruby
[03:22:30] donofrio: has joined #ruby
[03:22:59] donofrio: has joined #ruby
[03:30:11] Junaos: has joined #ruby
[03:31:45] donofrio: has joined #ruby
[03:36:33] tdy: has joined #ruby
[03:50:30] cschneid: has joined #ruby
[03:55:10] MasterAsia: has joined #ruby
[04:04:16] houhoulis: has joined #ruby
[04:09:11] braincrash: has joined #ruby
[04:15:11] _whitelogger: has joined #ruby
[04:19:51] roshanavand: has joined #ruby
[04:55:41] tdy: has joined #ruby
[05:14:17] tdy: has joined #ruby
[05:17:34] cnsvc: has joined #ruby
[05:18:16] za1b1tsu: has joined #ruby
[05:18:44] coderphive: has joined #ruby
[05:28:01] za1b1tsu: has joined #ruby
[05:48:06] cschneid: has joined #ruby
[06:00:45] rippa: has joined #ruby
[06:06:45] hutch: has joined #ruby
[06:11:54] za1b1tsu_: has joined #ruby
[06:15:52] za1b1tsu: has joined #ruby
[06:36:49] Exuma: has joined #ruby
[06:38:55] solocshaw: has joined #ruby
[06:44:55] cnsvc: has joined #ruby
[06:51:07] aupadhye: has joined #ruby
[06:59:26] dellavg_: has joined #ruby
[07:00:51] cschneid: has joined #ruby
[07:16:53] cnsvc: has joined #ruby
[07:24:38] elphe: has joined #ruby
[07:25:52] marz_d`ghostman: I'm using a gem that has this line: output = `#{cmd} 2>&1` . But in my script I have redirected $stderr to a logger instance and I'm getting a uninitialized stream error. How do I fix this one so the 2>&1 will also get redirected to the logger?
[08:16:39] Exuma: has joined #ruby
[08:31:13] cnsvc: has joined #ruby
[08:34:16] conta: has joined #ruby
[08:50:00] Pisuke: has joined #ruby
[08:54:18] neuraload: has joined #ruby
[09:13:10] elphe: has joined #ruby
[09:14:25] kapil____: has joined #ruby
[09:19:26] conta: has joined #ruby
[09:27:10] _whitelogger: has joined #ruby
[09:27:14] paranoicsan: has joined #ruby
[09:27:25] cnsvc: has joined #ruby
[09:55:11] rivalomega: has joined #ruby
[09:56:40] Guest49234: has joined #ruby
[10:01:15] dhollin3: has joined #ruby
[10:01:29] cschneid: has joined #ruby
[10:06:55] cruzo66342: has joined #ruby
[10:15:08] rubydoc: has joined #ruby
[10:16:53] cruzo66342: has joined #ruby
[10:32:25] isene: Thanks for the TLS debug, guys :-)
[10:33:15] paranoicsan: has joined #ruby
[10:35:10] prestorium: has joined #ruby
[10:36:30] za1b1tsu: has joined #ruby
[10:40:33] clemens3: has joined #ruby
[10:50:00] za1b1tsu: has joined #ruby
[11:03:26] mikecmpbll: has joined #ruby
[11:06:29] paranoicsan: has joined #ruby
[11:20:02] roshanavand: has joined #ruby
[11:30:56] cschneid: has joined #ruby
[11:38:54] MasterAsia: has joined #ruby
[11:41:35] reber: has joined #ruby
[11:45:41] tdy: has joined #ruby
[11:53:10] za1b1tsu: has joined #ruby
[11:59:19] conta: has joined #ruby
[12:09:05] elphe: has joined #ruby
[12:10:25] AJA4350: has joined #ruby
[12:12:25] venmx: has joined #ruby
[12:22:36] phaul: Merry Christmas everybody
[12:22:55] kapil____: has joined #ruby
[12:26:06] cruzo66342: has joined #ruby
[12:31:10] sticaz: has joined #ruby
[12:52:50] cnsvc: has joined #ruby
[13:01:25] gigetoo: has joined #ruby
[13:01:25] cschneid: has joined #ruby
[13:07:14] paranoicsan: has joined #ruby
[13:13:48] neuraload: has joined #ruby
[13:19:20] saltsa: has joined #ruby
[13:31:39] mostlybadfly: has joined #ruby
[13:35:20] isene: │11:32:25 isene │ Thanks for the TLS debug, guys :-) │ bastilian │·············
[13:35:34] isene: Sorry about that
[13:36:34] donofrio: has joined #ruby
[13:45:20] paranoicsan: has joined #ruby
[13:55:42] donofrio: has joined #ruby
[14:00:18] EXCHGR: has joined #ruby
[14:00:48] donofrio: has joined #ruby
[14:09:10] _whitelogger: has joined #ruby
[14:13:48] nchambers: has joined #ruby
[14:30:57] cschneid: has joined #ruby
[14:36:43] roshanavand: has joined #ruby
[14:36:56] donofrio: has joined #ruby
[14:39:39] Nobun: has joined #ruby
[14:40:27] Nobun: hi. I am not very confident with ruby (I almost not use ruby). However I am writing a script which MUST use ruby so I need some help
[14:40:56] bougyman: That's not an interesting problem.
[14:41:49] Nobun: 1) the script will be a kramdown builder (kramdown app is pretty limited on complex documentation with multiple files)
[14:43:00] Nobun: first problem is a very stupid one. I am trying to write a recursive file search and write it down to a list. When using Find.find nil values will found and I can't skip them. I will paste the part of code involving the problem
[14:44:56] Nobun: http://dpaste.com/243R5QG
[14:45:18] Nobun: the last comment is the error returned by ruby interpreter
[14:45:47] Nobun: xext_in is a string containing the extension
[14:46:20] bougyman: are you looking for all files?
[14:47:34] bougyman: Nobun: Dir.glob('**/*').select { |f| File.file? f }
[14:47:36] bougyman: try that instead.
[14:47:40] bougyman: see if it's what you want.
[14:48:27] bougyman: and then just use the select block for your comparison.
[14:48:45] bougyman: f =~ /#{xext_in}$/ instead of File.file? f
[14:49:37] bougyman: Or even just Dir.glob("**/*.#{xext_in}") probably
[14:51:33] Nobun: thank bougyman... I will try soon. However I found another issue not related to the lines I posted, but that could break also that function
[14:56:57] houhoulis: has joined #ruby
[14:57:54] Nobun: yeah... I did also a bad mistake... I used OptionParser but I didn't provide a way to have a default value so all values ended to have nil instead of default. This way ext_in was nil -.-
[15:00:06] Nobun: now also the function works. However I am trying to understand your suggestion... what is "**/*" exactly?
[15:00:59] Nobun: I understand that #{xext_in} is a variable replacer for regexp, but i can't get what is **/* exactly
[15:10:18] nowhere_man: has joined #ruby
[15:12:19] paranoicsan: has joined #ruby
[15:22:16] cruzo66342: has joined #ruby
[15:23:46] orbyt_: has joined #ruby
[15:32:20] catbusters: has joined #ruby
[15:42:38] nchambers: has joined #ruby
[15:46:12] cschneid: has joined #ruby
[15:46:50] segy: has joined #ruby
[15:46:56] Xiti: has joined #ruby
[15:59:01] sagax: has joined #ruby
[16:20:25] KeyJoo: has joined #ruby
[16:29:55] hutch: has joined #ruby
[16:39:02] nchambers: has joined #ruby
[16:39:11] hutch: has joined #ruby
[16:43:49] cruzo66342: has joined #ruby
[16:53:18] cnsvc: has joined #ruby
[17:04:46] cthulchu: has joined #ruby
[17:07:56] crankharder: has joined #ruby
[17:11:00] Xiti: has joined #ruby
[17:12:18] prestori_: has joined #ruby
[17:12:35] hutch: has joined #ruby
[17:17:53] lxsameer: has joined #ruby
[17:19:10] \void: has joined #ruby
[17:22:10] TomyLobo: has joined #ruby
[17:22:26] TomyLobo: rubygems.com is now a phishing site
[17:22:36] TomyLobo: redirecting to a domain registered yesterday evening
[17:23:07] TomyLobo: i could have sworn it once used to be a legit redirect to rubygems.org
[17:25:11] nchambers: perhaps it was forgotten about
[17:26:03] nchambers: https://i.imgur.com/bo0Pu0d.png oh dear
[17:26:58] TomyLobo: someone has that page on offer
[17:27:03] TomyLobo: and they put phishing on it?
[17:27:06] TomyLobo: how is that legal?
[17:27:13] nchambers: where is the phishing?
[17:27:21] nchambers: i just get a 403
[17:27:22] TomyLobo: the phishing was german
[17:27:27] TomyLobo: might be country-specific
[17:27:36] TomyLobo: also, i connected to :80
[17:33:44] kapil____: has joined #ruby
[17:33:46] elphe: has joined #ruby
[17:37:08] y0u: has joined #ruby
[17:38:55] cd: has joined #ruby
[17:40:00] ogres: has joined #ruby
[17:41:34] Iambchop: DomainTools screenshot history for rubygems.com https://usercontent.irccloud-cdn.com/file/f0RF1JH5/Capture%2B_2018-12-24-12-40-35.png
[17:49:32] cschneid: has joined #ruby
[17:50:22] donofrio: has joined #ruby
[17:50:22] Swyper: has joined #ruby
[17:50:27] Swyper: https://gist.github.com/
[17:50:44] Swyper: Failure/Error: expect(titleize("the bridge over the river kwai")).to eq("The Bridge over the River Kwai") expected: "The Bridge over the River Kwai" got: "thebridgeovertheriverkwai" (compared using ==)
[17:51:03] Swyper: any ideas where I am going wrong? it seems the if statements do not ever get executed
[17:52:13] elomatreb: You need to share the full gist URL
[17:52:39] Swyper: https://gist.github.com/RickArora/22d7365f5be63887000869cd137b82b9
[17:52:41] Swyper: sorry aha
[17:53:10] elphe: has joined #ruby
[17:53:16] hutch: has joined #ruby
[17:53:53] Swyper: I added the "jj" and "kk" to see if the if statements were even executing and they are not
[17:54:05] havenwood: Swyper: That gist doesn't seem to correspond with your test.
[17:54:41] havenwood: Swyper: It's a nice convention to use a plural for a collection and the corresponding singular for the block value when iterating over the collection.
[17:54:56] havenwood: Swyper: words.split.each do |word|
[17:55:01] Swyper: havenwood: can you expand on what you mean
[17:55:22] Swyper: havenwood: what I posted was just the method thats failing and what tests are failing
[17:55:46] havenwood: Swyper: You're not joining this version, so it doesn't seem to match the test one.
[17:55:51] Swyper: havenwood: if you refresh the gist I added comments with the tests that are failing
[17:56:02] Swyper: joining ?
[17:56:34] havenwood: &>> ['these', 'are', 'words'].join(' ') # Swyper
[17:56:35] elomatreb: Turning the array of words you got by split'ing back into a cohesive string
[17:56:38] rubydoc: # => "these are words" (https://carc.in/#/r/5umr)
[17:57:16] Swyper: oh right, I had a join in there before but was still getting the same output, so I tried to remove it to just see what string I have.. my main issue is the if else is not getting executed
[17:57:21] havenwood: Swyper: This is a great place to use #map instead of #each. I find I use #map far more than #each anyways.
[17:57:45] elomatreb: Your ifs are executed, the result is just discarded immediately because you're assigning the result of a call to #each
[17:58:16] elomatreb: #each always returns the collection it was called on, not what you do with that in the iterations
[17:58:28] Swyper: so your saying I'm assigning to a local variable within the if statement ?
[17:59:17] elomatreb: No, you are assigning to the "correct" variable, but when all the words are done, the assignment in line 2 overrides what you changed
[18:00:19] elomatreb: https://eval.in/1072074 for a reduced demo
[18:02:33] havenwood: &>> [1, 2, 3].map { |n| n + 42 } # Swyper
[18:02:34] rubydoc: # => [43, 44, 45] (https://carc.in/#/r/5ums)
[18:02:57] Swyper: https://gist.github.com/RickArora/22d7365f5be63887000869cd137b82b9
[18:02:58] havenwood: Swyper: Note how #map returns the result of applying the block to each element.
[18:03:11] Swyper: I updated it and I think I fixed that issue elomatreb
[18:03:23] Swyper: still not getting a correct output, tho
[18:03:34] agent_white: has joined #ruby
[18:03:56] havenwood: Swyper: It's a lot closer now.
[18:04:41] Swyper: ah I just don't have spaces now
[18:05:32] havenwood: Swyper: The Ruby convention is `new_word` instead of `newWord`. We don't actually ever use headlessCamelCase for anything.
[18:06:08] havenwood: Swyper: A shorthand for `newWord = newWord + i` is `newWord += i`.
[18:06:35] Swyper: thanks havenwood
[18:06:54] havenwood: Swyper: It's custom to drop the `return` from `return newWord` when it's the last line of a method. So just: newWord
[18:07:07] Swyper: so every word is separated with an underscore
[18:07:51] Swyper: the return just makes it obvious to me where the return is happening xD
[18:08:22] havenwood: Swyper: When you get used to Ruby, it's obvious that the last line of the method will return unless you've explicitly returned early.
[18:08:46] havenwood: Swyper: We just use `return` for early returns.
[18:09:10] havenwood: Swyper: But it doesn't do harm to put it there. You'll see in Ruby code you read it's almost always omitted.
[18:09:58] cruzo66342: has joined #ruby
[18:11:21] havenwood: Swyper: I'd highly recommend looking into #map, since it's so very useful.
[18:12:29] za1b1tsu: has joined #ruby
[18:12:39] Swyper: I will for sure, havenwood
[18:15:30] ChanServ: +o havenwood
[18:17:08] ChanServ: -o havenwood
[18:17:09] ChanServ: -o havenwood
[18:26:16] donofrio: has joined #ruby
[18:28:24] nchambers: is there a way to tell how many args a block passed to a function is expecting
[18:30:51] cruzo66342: has joined #ruby
[18:30:53] nchambers: nmd, looks like I want Proc#arity
[18:34:55] jottr: has joined #ruby
[18:38:11] themsay: has joined #ruby
[18:41:03] donofrio: has joined #ruby
[18:41:16] Nobun: has joined #ruby
[18:41:46] Nobun: problem with OptionParser: http://dpaste.com/268ZXFQ
[18:42:30] Nobun: if I run "script -x value" (where x is a flag) the option does not capture the 'value' I printed
[18:42:39] Nobun: in console
[18:42:55] Rudolph: you need to do --foo=bar
[18:43:03] Rudolph: or --foo=[bar] if it takes an optional argument
[18:43:14] paranoicsan: has joined #ruby
[18:43:36] Rudolph: ie, opt.on("-b", "--build=[DIR]", String, "...")
[18:43:55] Nobun: -b shortcut does not work?
[18:44:05] Rudolph: what do you mean
[18:44:07] Rudolph: what shortcut?
[18:44:22] Rudolph: it will automatically apply to -b and --build
[18:44:40] Nobun: Rudolph: in my code I have opt.on("-b", "--build=[DIR]", String, "...")
[18:44:47] Rudolph: thats not what you showed in the paste
[18:44:49] Nobun: as you can see in my example
[18:45:00] Rudolph: in the paste you just have: opt.on('-b', '--build', String,
[18:45:21] Nobun: ah so I have to use " instead of ' right?
[18:45:49] Rudolph: you have '-b', '--build'
[18:46:29] Rudolph: you need to tell it that it takes an argument with '-b FOO', '--build' or '-b', '--build=FOO'
[18:47:32] Nobun: sorry so how the code should look instead? I don't get it
[18:48:25] Nobun: for example opt.on('-e', '--input-ext', String, 'Input extension (default=md)') { |o| $options.extension_in = o }
[18:48:25] Nobun: how should be written instead?
[18:48:51] Rudolph: i mean, i've showed you how it looks
[18:48:54] Rudolph: im not sure what else to say
[18:49:23] Nobun: but I am not saying any differences (a part ' instead of ")
[18:49:45] donofrio: has joined #ruby
[18:50:04] Nobun: there is '-e', ther is '--input ext', ther is string and ther is description
[18:50:19] Rudolph: --input ext isn't the same as --input-ext
[18:50:37] Rudolph: one is a flag called --input-ext taking no arguments
[18:50:49] Rudolph: another is a flag called --input taking an argument ext
[18:51:02] Nobun: ah now I got it
[18:51:16] Nobun: so I have to write '--input-ext EXT'
[18:51:17] Rudolph: https://clbin.com/so21Y
[18:51:19] Rudolph: exactly, yeah
[18:52:02] Nobun: and the same change required in the first option or not?
[18:52:08] Nobun: I mean -b
[18:52:18] Rudolph: you can put it in either
[18:52:27] Rudolph: if its in one it will be applied to both
[18:54:00] Nobun: yeah... now it works :)
[18:59:10] za1b1tsu: has joined #ruby
[19:00:38] Nobun: the bad news is that the final result is not exactly as expected... but it is not a problem in my script, but in kramdown itself
[19:01:09] Nobun: for example, when creating html, links will refers to .md files and not .html files
[19:01:32] cschneid: has joined #ruby
[19:01:58] Nobun: I tried also kramdown -> latex and it is even worse... so probably I will focus my script to html output only in order to fix this issue
[19:05:25] dripup: has joined #ruby
[19:06:05] havenwood: Nobun: Here's a gist I did that shows off some lesser-known modern OptionParser features: https://gist.github.com/havenwood/02123198a79447543a3ea053e7e592fd
[19:06:52] donofrio: has joined #ruby
[19:07:11] havenwood: I like the new `into:` keyword argument for #parse! and #permute! particularly.
[19:07:28] havenwood: I've been meaning to write an article and contribute some docs.
[19:08:58] Rudolph: do you normally write articles?
[19:09:21] Rudolph: (and if so, can you link to where they're stored?)
[19:09:58] havenwood: Rudolph: I oddly don't have a place they're collected. Here's one: https://medium.com/square-corner-blog/rubys-new-jit-91a5c864dd10
[19:13:09] havenwood: https://medium.com/square-corner-blog/rubys-new-infinite-range-syntax-0-97777cf06270
[19:13:10] havenwood: https://medium.com/square-corner-blog/new-class-naming-rules-in-ruby-bb3b45150c37
[19:13:23] havenwood: https://medium.com/square-corner-blog/rubys-new-exception-keyword-arguments-4d5bbb504d37
[19:13:40] havenwood: Rudolph: I'll write some more and make a page that lists them. Thanks for the prodding!
[19:13:44] Rudolph: sweet, thanks
[19:14:28] Rudolph: i've been mainly following baweaver and medhi farsi, which are both great but would love to get some more sources as well
[19:14:38] havenwood: Rudolph: Also checkout baweaver's, haha beat me to it.
[19:15:09] havenwood: Rudolph: Here's one baweaver and I kinda did together: https://medium.com/square-corner-blog/exploring-ruby-2-6-enumerator-hash-and-enumerable-changes-11ffa4b12eb9
[19:15:10] havenwood: Rudolph: Yeah, Medhi's are great too. +1
[19:15:46] havenwood: Rudolph: baweaver and I are coworkers :)
[19:15:46] Rudolph: definitely, i've learned a lot of the finer details from syntax i just normally glaze over
[19:16:02] Rudolph: ah cool, you work at square too?
[19:16:27] Rudolph: nice, i didn't realize how ruby heavy they were
[19:18:05] marvin2: has joined #ruby
[19:18:23] havenwood: tons of Ruby! \o/
[19:18:37] donofrio: has joined #ruby
[19:19:49] dellavg_: has joined #ruby
[19:20:56] hutch: has joined #ruby
[19:27:38] Exuma: has joined #ruby
[19:30:45] armyriad: has joined #ruby
[19:41:25] elphe: has joined #ruby
[19:47:44] mspo: has joined #ruby
[20:03:04] mspo: is there a way to call a method without arguments explicitly? like foo = P.new( foo.empty? : nil ? foo ) ; the P.new(nil) is not the same as P.new()
[20:03:51] Rudolph: i normally do something like: args = []; ...; P.new *args
[20:03:55] Rudolph: not sure if there is a better way
[20:05:09] mspo: oops got my ?: mixed up there, but you get it
[20:07:32] Exuma: has joined #ruby
[20:11:50] venmx: has joined #ruby
[20:14:32] donofrio: has joined #ruby
[20:16:31] Rudolph: do the rubysec maintainers happen to idle in here?
[20:23:58] nowhere_man: has joined #ruby
[20:26:02] Nicmavr: has joined #ruby
[20:36:27] Exuma: has joined #ruby
[20:39:13] libertyprime: has joined #ruby
[20:43:00] donofrio: has joined #ruby
[20:52:19] tdy: has joined #ruby
[20:58:59] donofrio: has joined #ruby
[20:59:56] aonemd: has joined #ruby
[21:03:05] Freeaqingme: has left #ruby: ("http://quassel-irc.org - Chat comfortably. Anywhere.")
[21:04:05] donofrio: has joined #ruby
[21:17:54] Exuma: has joined #ruby
[21:30:05] houhoulis: has joined #ruby
[21:30:47] cschneid: has joined #ruby
[21:39:02] oncall-pokemon: has joined #ruby
[21:41:11] cthulchu: has joined #ruby
[21:50:08] jottr: has joined #ruby
[22:01:59] spacesuitdiver: has joined #ruby
[22:03:44] davidw: has joined #ruby
[22:08:56] tdy: has joined #ruby
[22:13:34] tdy: has joined #ruby
[22:32:27] donofrio: has joined #ruby
[22:40:42] m0w: has joined #ruby
[22:41:07] MasterAsia: has joined #ruby
[22:42:44] tiff: has joined #ruby
[22:51:20] donofrio: has joined #ruby
[22:58:45] isene: al2o3-cr: Would you mind adding your info to my reported ssl bug over at launchpad?
[23:05:42] elphe: has joined #ruby
[23:06:58] roshanavand: has joined #ruby
[23:12:19] Nobun: has joined #ruby
[23:12:40] Nobun: havenwood: thank for your link about OptionParser
[23:12:52] Nobun: good night
[23:17:34] darkhanb: has joined #ruby
[23:22:41] hutch: has joined #ruby
[23:25:55] cschneid: has joined #ruby
[23:28:24] elphe: has joined #ruby
[23:36:08] millerti: has joined #ruby
[23:38:09] zxq2: has joined #ruby
[23:38:17] nowhere_man: has joined #ruby
[23:44:57] donofrio: has joined #ruby
[23:52:25] darkhanb: has joined #ruby