« Back to channel list

#ruby - 01 December 2018

« Back 1 day Forward 1 day »
[00:06:01] bambanx: has joined #ruby
[00:12:20] SeepingN: has joined #ruby
[00:12:44] Puffball: has joined #ruby
[00:13:44] perique: has joined #ruby
[00:17:11] tdy: has joined #ruby
[00:17:37] Renich: has joined #ruby
[00:18:44] Renich: has joined #ruby
[00:28:40] mynameisdebian: has joined #ruby
[00:31:35] arescorpio: has joined #ruby
[00:32:53] graphene: has joined #ruby
[00:37:09] akem: has joined #ruby
[00:44:53] akem: has joined #ruby
[00:46:55] nchambers: has joined #ruby
[01:00:14] sanscoeur: has joined #ruby
[01:02:02] eckhardt_: has joined #ruby
[01:09:33] nadir: has joined #ruby
[01:18:42] roshanavand: has joined #ruby
[01:23:02] Azure: has joined #ruby
[01:24:01] Renich: has joined #ruby
[01:24:37] sgen: has joined #ruby
[01:25:03] Renich: has joined #ruby
[01:25:42] desnudopenguino: baweaver: that was like aesop's fable worthy. you wrapped some learning into a fun story.
[01:35:24] Renich: has joined #ruby
[01:36:31] Renich: has joined #ruby
[01:39:33] Fusl: has joined #ruby
[01:42:52] akem: has joined #ruby
[01:43:23] Fridtjof: has joined #ruby
[01:44:53] cnsvc_: has joined #ruby
[02:05:55] ghormoon: has joined #ruby
[02:18:24] hurricanehrndz: has joined #ruby
[02:25:22] akem: has joined #ruby
[02:26:06] ghormoon: has joined #ruby
[02:29:21] arand: has joined #ruby
[02:35:16] jottr: has joined #ruby
[02:41:21] mangold: has joined #ruby
[02:43:59] rawrg: has joined #ruby
[02:47:30] houhoulis: has joined #ruby
[02:55:31] sgen: has joined #ruby
[03:16:01] orbyt_: has joined #ruby
[03:22:25] lunorian: has joined #ruby
[03:32:26] lunorian: I'm learning Ruby and have a question about the `do` and `end` keywords. When defining a class I can type `class Person` and `end` but not include a `do` keyword. When is the `do` keyword required?
[03:33:50] akem: has joined #ruby
[03:34:36] Nicmavr: has joined #ruby
[03:43:29] jaddison: has joined #ruby
[03:48:09] mangold: has joined #ruby
[03:49:52] Iambchop: lunorian: "Ruby blocks are little anonymous functions that can be passed into methods. Blocks are enclosed in a do / end statement or between brackets {}" https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/#Understanding_Ruby_Blocks
[03:50:22] cnsvc_: has joined #ruby
[03:52:32] lunorian: Are class declarations different than blocks?
[03:55:19] Iambchop: e.g. "[1,2,3].each do |n| puts n; end" or "[1,2,3].each{|n| puts n}": the do/end (or {}) is an anonymous function passed into the each method
[04:00:05] lunorian: So I'm understanding how to use them, I'm more interesting in why the `do` keyword isn't required for Class declarations
[04:05:26] orbyt_: has joined #ruby
[04:06:47] Renich: has joined #ruby
[04:07:19] cnsvc_: has joined #ruby
[04:07:22] Renich: has joined #ruby
[04:07:26] Iambchop: I think that if it was "class Foo(a,b,c) do" the do keyword would be wasted and not provide any new info when parsing/reading the code that the class keyword didn't already provide. :)
[04:07:33] roshanavand: has joined #ruby
[04:10:09] braincrash: has joined #ruby
[04:13:27] Iambchop: Oh, I meant "class Foo do" or "def bar(a,b,c) do" there but squished them together. :-)
[04:17:23] lunorian: it's a matter of `Class Foo do` vs `Class Foo`
[04:17:36] lunorian: and why do isn't required for it but is possible to use it
[04:27:39] Renich: has joined #ruby
[04:28:42] Renich: has joined #ruby
[04:28:56] mangold: has joined #ruby
[04:32:51] Iambchop: What do you mean by "is possible to use it"? It's not posdible; "class Foo do" errors out. (There is a way to create an anonymous class that does not use the class keyword, but does use the do keyword; I was leaving that out because I didn't want to complicate matters.)
[04:35:01] tdy: has joined #ruby
[04:35:21] Iambchop: http://blog.jayfields.com/2008/02/ruby-creating-anonymous-classes.html
[04:36:14] jottr: has joined #ruby
[04:40:55] cnsvc_: has joined #ruby
[04:40:58] Iambchop: If you've seen code that used "Class.new do" that was an anonymous class. The do keyword is used there because it's actually passing a block to the "new" method. But, "normal" methods just use the class keyword.
[04:42:37] Iambchop: of course that should read "normal *classes*" :-)
[04:48:49] lunorian: thanks for the info
[04:48:56] lunorian: I'm going to read all of those blog posts in the morning
[04:49:06] lunorian: it's late here so I'm exiting for the night
[04:49:13] lunorian: have fun everyone :)
[04:55:00] tjmcginnis: has joined #ruby
[05:11:42] SCHAPiE: has joined #ruby
[05:51:41] rippa: has joined #ruby
[06:02:59] za1b1tsu: has joined #ruby
[06:10:23] mangold: has joined #ruby
[06:26:11] orbyt_: has joined #ruby
[06:34:50] mangold: has joined #ruby
[06:37:06] jottr: has joined #ruby
[06:50:08] kapil____: has joined #ruby
[06:55:59] roshanavand: has joined #ruby
[06:59:52] akem: has joined #ruby
[07:01:20] dbz: has joined #ruby
[07:01:51] akem: has joined #ruby
[07:07:34] za1b1tsu: has joined #ruby
[07:19:39] reber: has joined #ruby
[07:24:04] Renich: has joined #ruby
[07:25:08] Renich: has joined #ruby
[07:28:50] dbz: has joined #ruby
[07:30:31] alem0lars: has joined #ruby
[07:33:51] Tom-_: has joined #ruby
[07:35:26] Renich: has joined #ruby
[07:36:29] Renich: has joined #ruby
[07:45:51] akem: has joined #ruby
[07:50:50] dbz: has joined #ruby
[07:58:45] dellavg_: has joined #ruby
[08:01:48] Renich: has joined #ruby
[08:12:41] cnsvc_: has joined #ruby
[08:17:26] Renich: has joined #ruby
[08:21:40] danguita: has joined #ruby
[08:37:49] jottr: has joined #ruby
[08:40:31] waheedi: has joined #ruby
[08:49:05] nicesignal: has joined #ruby
[08:50:45] lxsameer: has joined #ruby
[08:57:10] alem0lars: has joined #ruby
[08:57:44] rubydoc: # => "test" (https://carc.in/#/r/5o2y)
[08:57:45] baweaver: havenwood save me
[09:04:49] Paraxial: has joined #ruby
[09:12:04] Paraxial: has joined #ruby
[09:13:22] cnsvc_: has joined #ruby
[09:27:45] Renich: has joined #ruby
[09:45:17] conta: has joined #ruby
[09:51:21] za1b1tsu: has joined #ruby
[10:05:57] LinuxKnight: has joined #ruby
[10:11:02] jottr: has joined #ruby
[10:23:47] venmx: has joined #ruby
[10:24:12] doubledup: has joined #ruby
[10:24:16] akem: has joined #ruby
[10:33:06] Renich: has joined #ruby
[10:34:23] Renich: has joined #ruby
[10:38:37] Fusl: has joined #ruby
[10:54:33] phaul: has joined #ruby
[11:06:54] mangold: has joined #ruby
[11:10:53] cnsvc_: has joined #ruby
[11:14:25] Renich: has joined #ruby
[11:20:21] keden: has joined #ruby
[11:24:02] venmx: has joined #ruby
[11:34:52] hahuang65: has joined #ruby
[11:36:04] troulouliou_dev: has joined #ruby
[11:40:47] Renich: has joined #ruby
[11:41:52] Renich: has joined #ruby
[11:45:47] graphene: has joined #ruby
[11:47:44] mangold: has joined #ruby
[12:06:02] dellavg_: has joined #ruby
[12:11:45] EvilJStoker: has joined #ruby
[12:15:39] cnsvc_: has joined #ruby
[12:16:04] AJA4350: has joined #ruby
[12:18:29] keden: has joined #ruby
[12:32:27] EvilJStoker: has joined #ruby
[12:42:07] roshanavand: has joined #ruby
[12:47:21] akem: has joined #ruby
[12:49:27] mangold: has joined #ruby
[13:03:58] vonfry: has joined #ruby
[13:08:11] ua_: has joined #ruby
[13:11:29] nchambers: has joined #ruby
[13:19:59] nchambers: has joined #ruby
[13:30:24] mangold: has joined #ruby
[13:30:45] nchambers: has joined #ruby
[13:37:00] gix: has joined #ruby
[13:37:31] apparition47: has joined #ruby
[13:42:52] dbz: has joined #ruby
[13:53:25] leitz: has joined #ruby
[13:56:09] cnsvc_: has joined #ruby
[13:59:09] nchambers: has joined #ruby
[14:14:14] paulscoder: has joined #ruby
[14:37:11] Renich: has joined #ruby
[14:37:52] nchambers: has joined #ruby
[14:38:16] Renich: has joined #ruby
[14:40:29] kapil____: has joined #ruby
[14:46:39] ghormoon: has joined #ruby
[14:48:38] bmurt: has joined #ruby
[14:50:58] reber: has joined #ruby
[14:52:25] nchambers: has joined #ruby
[14:56:26] clemens3: has joined #ruby
[14:58:18] marz_d`ghostman: has joined #ruby
[14:58:58] marz_d`ghostman: I'm trying to test my Module methods(self.method) in rspec. However, I'm getting uninitialized constant error. How do I test it like Module::Module.method?
[14:59:03] hahuang65: has joined #ruby
[15:01:31] phaul: marz_d`ghostman: post your code + errors. then we figure out what's wrong.
[15:02:47] phaul: otherwise methods are just methods.. Modules are just objects..
[15:03:07] AJA4350: has joined #ruby
[15:03:28] Exuma: has joined #ruby
[15:04:36] leitz: Anyone familiar with Sinatra? The json file just spews out a single string of everything. https://gist.github.com/LeamHall/9cdce5e3e01ac6a3b88504fc2d4577df
[15:07:06] phaul: &ri each_key
[15:07:06] rubydoc: I found 7 entries matching method each_key. Use &list each_key if you would like to see a list
[15:07:14] phaul: &ri Hash.each_key
[15:07:15] rubydoc: Found no entry that matches class Hash class method each_key
[15:07:41] phaul: leitz: each_key does not return the mapped things. It returns the Hash
[15:08:03] phaul: chain a .map on it : raiders.each_key.map
[15:08:09] leitz: phaul, ah. So I need to fix that.
[15:08:27] phaul: &ri Hash#each_key
[15:08:27] rubydoc: https://ruby-doc.org/core-2.5.3/Hash.html#method-i-each_key
[15:08:40] mangold: has joined #ruby
[15:14:50] phaul: leitz: probably there are more straightforward ways of doing that, you could call map on Hash directly. Or there is #each_value on hash, which would skip looking up the key and operating directly on value
[15:15:39] leitz: phaul, my goal is to make a link for each key, Still trying to figure it out.
[15:17:20] leitz: Ah, the return is just the last evaluated item.
[15:19:55] phaul: &>> {a: 1, b: 2}.map { |_k, v| "<a href='#{v}'></a>" }
[15:19:57] rubydoc: # => ["<a href='1'></a>", "<a href='2'></a>"] (https://carc.in/#/r/5o66)
[15:20:26] phaul: &>> {a: 1, b: 2}.map { |_k, v| "<a href='#{v}'></a>" }.join('<br />')
[15:20:26] rubydoc: # => "<a href='1'></a><br /><a href='2'></a>" (https://carc.in/#/r/5o67)
[15:23:03] leitz: Fixed. https://gist.github.com/LeamHall/4505dd8b86747ee7ea8d0d149712d4ba
[15:23:33] leitz: phaul, I tend to code in a very basic style. Suits me better, mostly due to my lower skills.
[15:26:32] phaul: leitz: important thing is to have fun :) I'm happy you got it working
[15:28:06] leitz: phaul, Ruby is the most fun language I know.
[15:33:32] AJA4350: has joined #ruby
[15:33:33] Renich: has joined #ruby
[15:34:39] Renich: has joined #ruby
[15:41:02] clarkema: has joined #ruby
[15:41:51] Inline: has joined #ruby
[15:42:39] cd: has joined #ruby
[15:45:48] RougeR: has joined #ruby
[15:46:44] Paraxial: has joined #ruby
[15:54:59] Renich: has joined #ruby
[15:56:03] Renich: has joined #ruby
[15:59:34] cnsvc_: has joined #ruby
[16:01:25] y0u: has joined #ruby
[16:01:34] Renich: has joined #ruby
[16:23:54] Exuma: has joined #ruby
[16:35:14] jnoon: has joined #ruby
[16:37:42] marz_d`ghostman: phaul: https://gist.github.com/marzdgzmn/ad3e68c5a36cddaa13db3938d018d5b8 It's giving my uninitialized constant Rise::MirrorManager::Mirror
[16:41:41] jnoon: i have a native rice ext wrapping a c++ lib working. the library im wrapping does some of its own threading with std::thread. one of the things i call takes a ruby lambda, makes it a void*, and the c++ lib passes that along to the a thread where eventually it should be called. but i cant just call it there on a non-ruby thread (crash). is there a way i can start a new ruby thread safely from a non-ruby thread in order to uncas
[16:41:42] jnoon: d* and call it? i know how to uncast and call it synchronously in the original thread and that works.
[16:43:28] kaleido: has joined #ruby
[16:43:44] phaul: marz_d`ghostman: is mirror.rb required in the spec?
[16:44:44] phaul: otherwise it should be defined, regardless of RSpec
[16:46:00] marz_d`ghostman: phaul: When you require files in spec files, is the path relative to the file like you'll have to put ../../.. to reach the root dir then go inside the /lib directories where your .rb files are?
[16:49:39] phaul: marz_d`ghostman: I ususally configure my include path in .gemspec. But otherwise require_relative can also work. if you just do require then it's using $:
[16:52:20] BTRE: has joined #ruby
[16:56:23] marz_d`ghostman: phaul: thanks, I'll look into it
[16:59:10] mangold: has joined #ruby
[17:07:50] conta: has joined #ruby
[17:07:59] nchambers: has joined #ruby
[17:08:27] lxsameer: has joined #ruby
[17:13:45] pskosinski: has joined #ruby
[17:16:57] Renich: has joined #ruby
[17:18:00] Renich: has joined #ruby
[17:25:58] nchambers: has joined #ruby
[17:53:00] cnsvc_: has joined #ruby
[17:54:32] troulouliou_dev: has joined #ruby
[17:55:55] chouhoulis: has joined #ruby
[17:59:16] desperek: has joined #ruby
[18:15:12] zautomata: has joined #ruby
[18:17:25] reber: has joined #ruby
[18:23:25] crankharder: has joined #ruby
[18:28:22] orbyt_: has joined #ruby
[18:32:10] cnsvc_: has joined #ruby
[18:36:48] nchambers: has joined #ruby
[18:40:16] jcarl43: has joined #ruby
[18:58:27] za1b1tsu: has joined #ruby
[19:00:50] havenwood: I just packaged a Ruby command line app and released it on snap. It's pretty nice...
[19:01:32] havenwood: Getting Snap and AWS Lambda support in one day.. good stuff!
[19:01:58] graphene: has joined #ruby
[19:02:45] havenwood: If you want a command line SipHash ¯\_(ツ)_/¯ you can now: sudo snap install siphash
[19:04:36] havenwood: https://snapcraft.io/siphash
[19:05:41] crankharder: has joined #ruby
[19:11:17] EvilJStoker: has joined #ruby
[19:20:43] Xiti: has joined #ruby
[19:26:11] bmurt: has joined #ruby
[19:35:05] Zarthus: not a fan of snaps, but well done :)
[19:42:25] awkwords: has joined #ruby
[19:48:11] dbz: has joined #ruby
[19:54:31] kapil____: has joined #ruby
[19:54:41] BaroMeter: has joined #ruby
[19:56:01] BaroMeter: has left #ruby: ()
[19:57:26] waheedi: has joined #ruby
[20:00:21] kapil____: has joined #ruby
[20:01:07] TheBloke: has joined #ruby
[20:02:11] Xeago: has joined #ruby
[20:02:13] kapil____: has joined #ruby
[20:02:36] dbz: has joined #ruby
[20:03:45] marz_d`ghostman: Is it good practice to place a self.log on the top most module so that I can just call it anywhere whenever I want to log something?
[20:05:24] cnsvc_: has joined #ruby
[20:05:26] SeepingN: has joined #ruby
[20:05:36] Zarthus: well it will never be the best practice
[20:05:42] Zarthus: but if you're writing something small, why not
[20:07:42] planigan: has joined #ruby
[20:13:09] crankharder: has joined #ruby
[20:15:20] marz_d`ghostman: Is there a way to make sure a file gets run before anything else? Like I have a config/initializer/test.rb that popuplates config variables. I'd like that to run since the constant I'm declaring under a module is saying its nil since it depends on the config variables
[20:18:41] Zavoli: has joined #ruby
[20:20:58] waheedi: has joined #ruby
[20:25:15] nchambers: has joined #ruby
[20:29:54] andrevan: has joined #ruby
[20:29:59] crankharder: has joined #ruby
[20:30:05] tdy: has joined #ruby
[20:31:39] phaul: has joined #ruby
[20:31:54] rubydoc: has joined #ruby
[20:43:29] waheedi: has joined #ruby
[20:43:35] cnsvc_: has joined #ruby
[20:49:54] evdubs: has joined #ruby
[20:50:25] crankharder: has joined #ruby
[20:57:03] marz_d`ghostman: Is this considered elegant in ruby though? https://gist.github.com/marzdgzmn/9b5487ce460236f8d462cbc717a9b0f3
[21:05:49] sauvin: has joined #ruby
[21:08:42] gnufied: has joined #ruby
[21:16:43] SeepingN: has joined #ruby
[21:18:49] white_lilies: has joined #ruby
[21:33:10] andrevan: has joined #ruby
[21:33:14] jetchisel: has joined #ruby
[21:39:53] jcalla: has joined #ruby
[21:41:57] ss_much: has joined #ruby
[21:46:33] cnsvc_: has joined #ruby
[21:57:14] patr0clus: has joined #ruby
[22:07:33] roshanavand: has joined #ruby
[22:21:03] kapil____: has joined #ruby
[22:48:53] moei: has joined #ruby
[22:53:46] cnsvc_: has joined #ruby
[23:00:53] ruby[bot]: has joined #ruby
[23:00:53] ChanServ: +o ruby[bot]
[23:06:50] AJA4350: has joined #ruby
[23:07:33] al2o3-cr: has joined #ruby
[23:11:46] Xiti`: has joined #ruby
[23:13:06] AJA4350: has joined #ruby
[23:21:57] AJA4350: has joined #ruby
[23:23:15] Xiti: has joined #ruby
[23:28:23] akem: has joined #ruby
[23:29:51] AJA4350: has joined #ruby
[23:39:42] bonhoeffer_: has joined #ruby
[23:40:56] phaul: has joined #ruby
[23:52:25] dbz: has joined #ruby
[23:55:18] dbz: has joined #ruby