« Back to channel list

#ruby - 16 January 2019

« Back 1 day Forward 1 day »
[00:01:49] mat_bug: has joined #ruby
[00:02:15] Scriptonaut: has joined #ruby
[00:04:51] donofrio: has joined #ruby
[00:07:50] mat_bug: has joined #ruby
[00:15:33] r29v: has joined #ruby
[00:19:52] jaddison: has joined #ruby
[00:19:53] mat_bug: has joined #ruby
[00:21:57] ramfjord: has joined #ruby
[00:25:53] mat_bug: has joined #ruby
[00:38:17] mat_bug: has joined #ruby
[00:39:00] hutch: has joined #ruby
[00:50:54] mat_bug: has joined #ruby
[00:51:00] ur5us: has joined #ruby
[00:51:20] Eiam: has joined #ruby
[00:51:39] thoraxe: has joined #ruby
[00:55:55] orbyt_: has joined #ruby
[00:56:56] mat_bug: has joined #ruby
[00:57:33] donofrio: has joined #ruby
[00:57:49] Scriptonaut: I'm having some really strane behavior with overriding a setter method on an object, I've explained the error in the gist I'm about to post, but I'll summarize here. I call super in a method override for a setter method. When I call that method, I get "NoMethoderror: super: no superclass method". However the original method is defined, when I comment out the method override definition I can call it just
[00:57:58] Scriptonaut: https://gist.github.com/robins35/037d32e052d3099d8ce317c9c2c6c19d
[00:59:30] Scriptonaut: also when I comment out the method override, my_object.methods includes my method. So the error is complaining that there is no superclass method, when there definitely is a superclass method
[01:00:50] x0F: has joined #ruby
[01:01:27] AJA4350: has joined #ruby
[01:02:56] mat_bug: has joined #ruby
[01:03:39] uplime: has joined #ruby
[01:06:00] phaul: Scriptonaut: what's GlobalUser.superclass and what is GlobalUser.superclass.instance_methods.grep /receive_direct_message/
[01:07:08] Scriptonaut: superclass is PgsqlDatabase(abstract), and result of that grep is []. I'm not trying to call a method on the super class though, I'm trying to call the method that existed there before it was overrode
[01:07:29] phaul: doesn't matter. super calls superclass
[01:08:18] Scriptonaut: hmm, this is so odd, isn't there a way to call the method that a certain method overrode?
[01:08:45] Scriptonaut: ya, you're right, I wonder what I was thinking. I confused something here
[01:09:10] Scriptonaut: I guess there probably isn't a way
[01:09:14] phaul: there is module prepend and rails used to do method alias chain
[01:09:43] phaul: https://stackoverflow.com/questions/3695839/ruby-on-rails-alias-method-chain-what-exactly-does-it-do
[01:10:03] phaul: quick google I havent actually read this, but should point you in the right direction anyway
[01:10:52] leftylink: I seem to recall a way to preserve the old one before overriding it, mabe it was something to do with `method(:receive_direct_message_alerts=)` . sorry I don't have the exact stuff right now
[01:11:10] Scriptonaut: ya, me too, I could have sworn there was a common way to do this
[01:11:25] phaul: module prepend is the modern way of doing this
[01:11:31] Scriptonaut: I think maybe I just got so used to using it in descended classes that I started to think I could use it everywhere
[01:11:52] phaul: override it in a module that you prepend, and in that module you *can* call super
[01:12:14] Scriptonaut: ah ya that should work
[01:12:18] leftylink: &>> def asdf; :hello end; m = method(:asdf); def asdf; :overridden end; m.call
[01:12:22] rubydoc: # => :hello (https://carc.in/#/r/60ce)
[01:12:53] leftylink: considerably more janky, it is true that module prepend is a less jank way
[01:13:33] Scriptonaut: I think I figured out where I got confused. This is a text-based json column for an active record object. Normally I do this, but rather than super I call read_attribute(:blah)
[01:14:02] Scriptonaut: since this column already comes with a getter/setter out of the gate that parses the json text, I can't simply get rid of it and rely on read_attribute
[01:14:27] bmurt: has joined #ruby
[01:16:04] mat_bug: has joined #ruby
[01:16:28] phaul: &>> class X; def f; 1; end; end; module Y; def f; super * 10; end; end; X.prepend(Y); X.new.f
[01:16:28] rubydoc: # => 10 (https://carc.in/#/r/60cf)
[01:18:41] Scriptonaut: ya that will work for sure. I think it that level of confusion won't be worth it, I can just rename the original getter/setter, and then keep the current name for the setter override, and add a getter override as well
[01:18:54] Scriptonaut: I think that level**
[01:19:36] Scriptonaut: people won't think to look at the bottom of the file for X.prepend
[01:20:31] Scriptonaut: unless there's a way to do: def self.included(klass); klass.prepend my_method; end
[01:22:53] mat_bug: has joined #ruby
[01:22:56] phaul: it doesn't have to be at the bottom of the file it can be right next to your method
[01:22:59] Scriptonaut: This guy ran into the same issue as me https://blog.arkency.com/2016/02/using-anonymous-modules-and-prepend-to-work-with-generated-code/
[01:24:29] phaul: &>> class X; def f; 1; end; self.prepend(Module.new { def f; super * 10; end; }); end; X.new.f
[01:24:30] rubydoc: # => 10 (https://carc.in/#/r/60cg)
[01:24:48] Scriptonaut: oh, that's pretty coo
[01:24:53] Scriptonaut: I think I'll do that
[01:25:38] Scriptonaut: ah I see, it's because the method is defined via metaprogramming
[01:25:51] Scriptonaut: in my example
[01:28:49] hutch: has joined #ruby
[01:28:58] mat_bug: has joined #ruby
[01:31:47] tdy: has joined #ruby
[01:38:28] houhoulis: has joined #ruby
[01:40:16] r3m: has joined #ruby
[01:41:22] mat_bug: has joined #ruby
[01:45:32] baweaver: https://bugs.ruby-lang.org/issues/15541
[01:45:36] Nicmavr: has joined #ruby
[01:45:57] baweaver: JSON.parse(data, symbolize_names: true) -> JSON.parse(data, symbolize_keys: true)
[01:46:20] baweaver: havenwood: Kinda want this thing to go away
[01:49:33] tdy: has joined #ruby
[01:52:30] tdy: has joined #ruby
[01:53:49] Scriptonaut: has left #ruby: ()
[01:54:59] mat_bug: has joined #ruby
[02:00:15] cthulchu: has joined #ruby
[02:00:57] duderonomy: has joined #ruby
[02:01:23] donofrio: has joined #ruby
[02:07:57] mat_bug: has joined #ruby
[02:12:58] r29v: has joined #ruby
[02:14:03] mat_bug: has joined #ruby
[02:20:57] mat_bug: has joined #ruby
[02:26:28] AJA4350: has joined #ruby
[02:27:01] mat_bug: has joined #ruby
[02:33:06] mat_bug: has joined #ruby
[02:37:42] tdy: has joined #ruby
[02:39:12] bmurt: has joined #ruby
[02:40:52] davidw_: has joined #ruby
[02:45:29] mat_bug: has joined #ruby
[02:52:58] tdy: has joined #ruby
[02:58:07] mat_bug: has joined #ruby
[02:58:21] bmurt: has joined #ruby
[02:59:32] hutch: has joined #ruby
[03:04:13] houhoulis: has joined #ruby
[03:19:06] minimal_life: has joined #ruby
[03:22:22] tdy: has joined #ruby
[03:27:11] _whitelogger: has joined #ruby
[03:28:00] j416: has joined #ruby
[03:33:58] donofrio: has joined #ruby
[03:34:42] paranoicsan: has joined #ruby
[03:36:10] mat_bug: has joined #ruby
[03:49:11] mat_bug: has joined #ruby
[04:01:33] mat_bug: has joined #ruby
[04:03:42] \void: has joined #ruby
[04:08:13] mat_bug: has joined #ruby
[04:09:33] braincrash: has joined #ruby
[04:21:12] mat_bug: has joined #ruby
[04:24:13] tdy: has joined #ruby
[04:27:14] mat_bug: has joined #ruby
[04:33:15] mat_bug: has joined #ruby
[04:39:16] mat_bug: has joined #ruby
[04:48:33] havenwood: baweaver: +1
[04:48:51] baweaver: Ah, other window
[04:49:46] sauvin: has joined #ruby
[04:50:24] tdy: has joined #ruby
[04:54:56] za1b1tsu: has joined #ruby
[04:57:38] esrse: has joined #ruby
[05:05:32] jtperreault: has joined #ruby
[05:08:49] Nightmare: has joined #ruby
[05:09:50] ByronJohnson: has joined #ruby
[05:09:53] kapil____: has joined #ruby
[05:11:08] mat_bug: has joined #ruby
[05:17:20] mat_bug: has joined #ruby
[05:23:20] mat_bug: has joined #ruby
[05:25:33] ByronJohnson: has joined #ruby
[05:26:01] Arahael: has joined #ruby
[05:26:24] Arahael: I'm hoping to query zeroconf from ruby, however I'm a bit lost. Can anyone recommend a library that works with a recent ruby?
[05:29:18] mat_bug: has joined #ruby
[05:35:17] mat_bug: has joined #ruby
[05:35:20] Arahael: I seem to have it working fine in go and python, but not ruby.
[05:35:28] Jello_Raptor: has joined #ruby
[05:38:25] paranoicsan: has joined #ruby
[05:41:18] mat_bug: has joined #ruby
[05:43:59] Arahael: Blegh, turns out I can't use zeroconf anyway in this network topography.
[05:47:22] mat_bug: has joined #ruby
[05:48:27] tdy: has joined #ruby
[05:49:18] sarink: has joined #ruby
[05:49:28] scrptktty: has joined #ruby
[05:49:56] ur5us: has joined #ruby
[05:53:15] mat_bug: has joined #ruby
[06:05:56] mat_bug: has joined #ruby
[06:13:23] aufi: has joined #ruby
[06:21:20] conta: has joined #ruby
[06:24:53] reber: has joined #ruby
[06:25:22] mat_bug: has joined #ruby
[06:30:11] dhollinger: has joined #ruby
[06:31:21] mat_bug: has joined #ruby
[06:32:31] krawchyk_: has joined #ruby
[06:38:24] mat_bug: has joined #ruby
[06:44:26] mat_bug: has joined #ruby
[06:50:27] mat_bug: has joined #ruby
[06:52:07] cnsvc: has joined #ruby
[06:53:15] profetes: has joined #ruby
[06:56:34] mat_bug: has joined #ruby
[07:03:25] donofrio: has joined #ruby
[07:04:53] sanscoeur: has joined #ruby
[07:08:54] mat_bug: has joined #ruby
[07:15:30] mat_bug: has joined #ruby
[07:21:32] mat_bug: has joined #ruby
[07:22:59] porg: has joined #ruby
[07:26:15] paranoicsan: has joined #ruby
[07:26:31] feep[work]: has joined #ruby
[07:26:52] feep[work]: how do I access a method defined in a required file from within a class that defines an accessor method with the same name?
[07:28:32] baweaver: Have an example?
[07:28:57] baweaver: Ideally you don't do that. Also that's quite a mouthful to say out loud
[07:29:17] feep[work]: also I figured out a workaround by just aliasing the thing
[07:29:53] baweaver: That'd work.
[07:30:06] feep[work]: uh it's kinda specific, we're using ruby/rake for building, and we have a helper function called unittest and I'm defining a class with a list of unittest source files also called unittest
[07:30:23] feep[work]: so I'm just gonna alias the function to unittest_, lol
[07:30:41] feep[work]: or run_unittests, that's probably better
[07:34:27] za1b1tsu: has joined #ruby
[07:42:38] sauvin: has joined #ruby
[07:43:08] aupadhye: has joined #ruby
[07:48:25] tdy: has joined #ruby
[08:00:46] mat_bug: has joined #ruby
[08:03:20] porg: has joined #ruby
[08:07:34] feep[work]: has left #ruby: ()
[08:09:24] krawchyk: has joined #ruby
[08:12:21] clemens3_: has joined #ruby
[08:13:11] BH23: has joined #ruby
[08:26:36] ur5us: has joined #ruby
[08:27:13] wildermind: has joined #ruby
[08:29:12] bairyn: has joined #ruby
[08:45:58] jmcgnh: has joined #ruby
[08:49:38] ua: has joined #ruby
[08:53:08] xrexeon: has joined #ruby
[08:54:13] xrexeon: has joined #ruby
[08:56:36] arekushi: has joined #ruby
[09:02:44] mikecmpbll: has joined #ruby
[09:31:35] lxsameer: has joined #ruby
[09:52:22] jacksop: has joined #ruby
[09:57:59] venmx: has joined #ruby
[10:04:25] Sylario: has joined #ruby
[10:17:48] za1b1tsu: has joined #ruby
[10:37:09] d^sh: has joined #ruby
[10:40:25] paranoicsan: has joined #ruby
[10:45:09] za1b1tsu: has joined #ruby
[10:59:21] jacksop: has joined #ruby
[11:01:02] fanta7531: has joined #ruby
[11:10:02] jacksop: has joined #ruby
[11:15:31] conta: has joined #ruby
[11:23:49] BH23: has joined #ruby
[11:34:08] lxsameer: has joined #ruby
[11:46:22] jacksop: has joined #ruby
[11:49:26] chichou: has joined #ruby
[12:25:51] Nicmavr: has joined #ruby
[12:27:20] djdduty: has joined #ruby
[12:29:06] foxxx0: has joined #ruby
[12:32:12] jaddison_: has joined #ruby
[12:32:22] mikecmpb_: has joined #ruby
[12:36:48] akemot: has joined #ruby
[12:38:10] lxsameer: has joined #ruby
[12:42:02] clemens3_: has joined #ruby
[12:49:10] lxsameer: has joined #ruby
[13:00:29] yokel: has joined #ruby
[13:00:32] prestorium: has joined #ruby
[13:10:03] bmurt: has joined #ruby
[13:32:49] arup_r: has joined #ruby
[13:33:59] clemens3_: has joined #ruby
[13:37:43] foxxx0: has joined #ruby
[13:41:03] spiette: has joined #ruby
[13:44:01] minimal_life: has joined #ruby
[13:45:46] chouhoulis: has joined #ruby
[13:48:33] AJA4350: has joined #ruby
[13:49:47] stryek: has joined #ruby
[13:52:27] akemot: has joined #ruby
[13:54:39] donofrio_: has joined #ruby
[13:54:50] akemot: has joined #ruby
[13:56:34] akemot: has joined #ruby
[14:01:11] xrexeon: has joined #ruby
[14:02:25] Avinash: has joined #ruby
[14:09:32] akem: has joined #ruby
[14:12:44] status402: has joined #ruby
[14:21:12] akem: has joined #ruby
[14:21:34] lfish: has joined #ruby
[14:27:46] arup_r: has joined #ruby
[14:33:08] donofrio: has joined #ruby
[14:33:45] jottr: has joined #ruby
[14:43:43] Avinash: has joined #ruby
[14:52:32] lfish: hello, I'm reading how to use the libusb gem for serial communication. Is there any higher level library?
[14:55:58] up|ime: i think rubygems has reverse dependency trees?
[14:56:10] rippa: has joined #ruby
[14:56:12] up|ime: yeah, https://rubygems.org/gems/libusb/reverse_dependencies
[14:56:52] ua: has joined #ruby
[14:59:17] hutch: has joined #ruby
[15:10:08] Rapture: has joined #ruby
[15:14:27] chouhoulis: has joined #ruby
[15:14:43] twobitsprite: has joined #ruby
[15:17:34] status402_: has joined #ruby
[15:17:35] orbyt_: has joined #ruby
[15:19:35] moei: has joined #ruby
[15:20:26] KeyJoo: has joined #ruby
[15:21:21] KeyJoo: has joined #ruby
[15:24:19] KeyJoo: has joined #ruby
[15:24:29] uplime: has joined #ruby
[15:25:08] porg: has joined #ruby
[15:26:54] krawchyk: has joined #ruby
[15:27:09] KeyJoo: has joined #ruby
[15:30:00] KeyJoo: has joined #ruby
[15:30:15] conta: has joined #ruby
[15:30:30] j416: has joined #ruby
[15:30:39] dinfuehr: has joined #ruby
[15:32:51] KeyJoo: has joined #ruby
[15:35:39] KeyJoo: has joined #ruby
[15:38:24] KeyJoo: has joined #ruby
[15:38:40] j416: has joined #ruby
[15:42:33] Inline: has joined #ruby
[15:45:06] conta: has joined #ruby
[15:46:41] kapil____: has joined #ruby
[15:52:21] gnufied: has joined #ruby
[15:55:26] mzo: has joined #ruby
[16:06:57] Dbugger: has joined #ruby
[16:07:03] porg: has joined #ruby
[16:09:32] davidw_: has joined #ruby
[16:16:17] tdy: has joined #ruby
[16:18:36] arup_r: has joined #ruby
[16:20:39] sgen: has joined #ruby
[16:27:28] chouhoulis: has joined #ruby
[16:31:34] sarink: has joined #ruby
[16:31:45] donofrio_: has joined #ruby
[16:37:34] donofrio: has joined #ruby
[16:39:01] noob69: has joined #ruby
[16:39:20] noob69: Anyone has any idea why I might get "SystemStackError: stack level too deep" when I try to push my rails app to heroku? Rails : 4.2
[16:40:10] ruby[bot]: We can't help you without your code, please post it to https://gist.github.com
[16:40:43] ruby[bot]: please post the full error output, including the command invocation that produces it and any mentioned log files to https://gist.github.com
[16:40:58] porg: has joined #ruby
[16:41:59] noob69: phaul: Error : https://pastebin.com/kvh7sqRn
[16:41:59] ruby[bot]: noob69: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[16:42:27] jottr: has joined #ruby
[16:43:05] noob69: phaul: Error in gist.github.com : https://gist.github.com/arav93/a01b9598cb02d5dcce1ec12cd26167c4
[16:43:30] noob69: phaul: Should I share my production.rb or something else?
[16:47:26] phaul: no I think it's the Rakefile. you should run it with verbose out and try to get the logs from that
[16:48:16] noob69: phaul: I'm trying to push to heroku, so is it even possible to run it with verbose?
[16:48:26] noob69: Locally, the app is working perfectly.
[16:48:33] noob69: I'm able to precompile locally.
[16:49:25] phaul: my heroku knowledge is really foggy I only tried it once in the past. Can you not set how to run rake via some environment variables?
[16:49:54] \void: has joined #ruby
[16:50:15] phaul: it seems you can just give it normal switches https://devcenter.heroku.com/articles/rake
[16:50:33] noob69: "rake assets:precompile" --> this command works both in development as well as production
[16:52:28] phaul: or try heroku run rake --trace assets:precompile
[16:53:09] noob69: Ok, I'll try that.
[16:54:34] noob69: phaul: Ok, that's strange. I got this error : https://gist.github.com/arav93/c4f6846d815a22e66cdcbdde6aef2532
[16:55:23] kaleido: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[16:57:12] darris: has joined #ruby
[16:57:43] phaul: yeah Im not too familiar with heroku, sorry... I was hoping to get a backtrace somehow, but I'm not sure how.
[16:58:16] profetes: has joined #ruby
[16:58:42] noob69: phaul: Thanks anyway! This is really strange though
[17:01:05] DTZUZO: has joined #ruby
[17:02:07] Sonnenmann: has joined #ruby
[17:04:03] sputnik13: has joined #ruby
[17:09:55] hutch: has joined #ruby
[17:22:13] jottr: has joined #ruby
[17:28:22] cthulchu_: has joined #ruby
[17:28:39] hiroaki: has joined #ruby
[17:31:47] polishdub: has joined #ruby
[17:32:36] porg: has joined #ruby
[17:33:37] arup_r: has joined #ruby
[17:35:00] arup_r: has joined #ruby
[17:35:42] porg: has joined #ruby
[17:37:36] sanscoeur: has joined #ruby
[17:38:46] hutch: has joined #ruby
[17:42:20] jcarl43: has joined #ruby
[17:43:01] gothicsouth: has joined #ruby
[17:43:49] noob69: phaul: Somehow managed to fix it!
[17:44:02] noob69: It has been deployed, the assets haven't come up properly.
[17:44:07] noob69: But I'm glad nevertheless.
[17:45:04] phaul: c00l. important thing is that it works
[17:47:22] arup_r: has joined #ruby
[17:51:34] noob69: phaul: Yeah. I have to fix the assets issue, but atleast I made some progress!
[17:54:21] lxsameer: has joined #ruby
[17:55:30] sandelius: has joined #ruby
[18:05:27] phaul: evening sandelius
[18:07:32] gix: has joined #ruby
[18:09:55] fmcgeough: has joined #ruby
[18:33:16] Aqo: has joined #ruby
[18:38:48] cagomez: has joined #ruby
[18:43:32] hiroaki: has joined #ruby
[18:44:37] mikecmpbll: has joined #ruby
[18:49:06] conta1: has joined #ruby
[18:49:17] gothicsouth: has joined #ruby
[18:49:23] r29v: has joined #ruby
[18:50:31] themsay: has joined #ruby
[18:51:32] ramfjord: has joined #ruby
[19:02:59] cagomez: has joined #ruby
[19:05:26] donofrio__: has joined #ruby
[19:10:06] cagomez: has joined #ruby
[19:11:12] orbyt_: has joined #ruby
[19:21:57] sarink: has joined #ruby
[19:47:27] hiroaki: has joined #ruby
[19:47:30] sarink: has joined #ruby
[19:47:32] szulak_: has joined #ruby
[19:49:33] sarink: has joined #ruby
[19:50:02] cnsvc: has joined #ruby
[19:52:36] prestorium: has joined #ruby
[19:53:49] dellavg_: has joined #ruby
[19:58:31] donofrio__: has joined #ruby
[19:59:15] sarink: has joined #ruby
[20:04:05] prestorium: has joined #ruby
[20:07:04] twobitsprite: has joined #ruby
[20:15:33] ur5us: has joined #ruby
[20:40:11] gothicsouth: has joined #ruby
[20:40:33] ellcs: has joined #ruby
[20:43:31] hutch: has joined #ruby
[20:46:54] conta2: has joined #ruby
[20:47:31] donofrio_: has joined #ruby
[20:49:24] Hoffman: has joined #ruby
[20:50:25] Hoffman: hey, do you know why I might see rspec say that 2 identical objects differ? https://repl.it/repls/LeafyCourageousBytes
[20:55:08] ponzii: has joined #ruby
[20:56:23] ponzii: I read that Ruby modules don't have instances yet in many gem sources I see instance variables all over the place.
[20:59:09] phaul: Hoffman: you are using a private API which I don't think was meant to be used to check for equality. There diff description is "empty", only a newline.
[20:59:19] ponzii: I'm even seeing @variable outside module scope, ie. in file/main scope, in, for example Nokogiri source.
[21:00:14] Hoffman: phaul: how can I tell the API is private
[21:01:22] phaul: Hoffman: https://github.com/rspec/rspec-support/
[21:01:53] Hoffman: phaul: ah, need to submit an errata thing to Packt I guess
[21:02:25] Hoffman: phaul: can you tell me what you mean by 'There diff description is "empty", only a newline'
[21:02:34] Hoffman: those 2 things are opposites; a newline is content and thus not empty
[21:04:18] phaul: I mean looking at the diffing method it seems they try to format for RSpec output only considering how it would look if it has to print a diffable object mismatch. They don't seem to care about extra newlines not being in the actual strings they are diffing.
[21:05:18] phaul: I meant on that gihub project page the first sentence is : Not intended for direct use.
[21:05:58] Hoffman: yea, tryna find out what they replaced it with
[21:05:59] gothicsouth: has joined #ruby
[21:06:59] kmossco: has joined #ruby
[21:07:51] cd: has joined #ruby
[21:08:45] phaul: ponzii: yes modules cannot be instatiated. But they can be mixed in into classes. In that case their instance variables will belong to the instance of the class
[21:09:35] Hoffman: yeah cant find if they replaced it with anything
[21:09:40] ponzii: phaul: Isn't this kind of tying implementation a code smell in most languages?
[21:09:42] Hoffman: after moving it into RSpec::Support
[21:09:45] Hoffman: real shame
[21:10:03] Fernando-Basso: has joined #ruby
[21:10:37] ponzii: phaul: Isn't a module, in the ordinary definition, a self-contained unit not something which makes assumptions about how it will be used?
[21:11:44] ponzii: phaul: As I mentioned, I'm even seeing instance variables outside module scope. What gives?
[21:12:27] phaul: hm there are two kind of modules. Modules that are meant to be mixed in and modules that are meant to be used on their own. (and some whacky ones that can do both). Bot each kind is a self contained unit that's sensible on its own.
[21:14:17] phaul: Just the ones that are mixins exist to be mixed in. There is some tying there sometimes with what the mixing in class should implement. That's usually well documented. Examples: Comparable wants <=>. Enumerable wants each.
[21:14:26] ponzii: phaul: I can't see how anything which makes assumptions about its usage can be self-contained.
[21:17:02] phaul: maybe not self contained but the best option for what it does: implement some common aspect of classes that would have been replicated in all classes otherwise, but something that is tightly coupled with the class. Like being Comparable is a good example. Common task, but the actual class know how to do <=>.
[21:18:01] phaul: let's talk about the other question you asked. instance vars outside of Module scope. can you link the line on github?
[21:18:02] ponzii: phaul: Better language design would have been to distinguish Module and Mixin.
[21:18:40] donofrio_: has joined #ruby
[21:20:09] ponzii: phaul: https://github.com/sparklemotion/nokogiri/blob/master/bin/nokogiri
[21:20:40] phaul: what line number are you looking at?
[21:20:48] ponzii: phaul: Module scope ends at line 37 after which numerous instance variables are defined.
[21:22:06] ponzii: phaul: @doc, @rng, @script etc.
[21:23:37] phaul: https://banisterfiend.wordpress.com/2010/11/23/what-is-the-ruby-top-level/
[21:24:06] ponzii: phaul: Top-level is main, no?
[21:24:13] al2o3-cr: ponzii: yeah.
[21:24:20] ponzii: phaul: I mean outside module scope.
[21:24:41] code_zombie: has joined #ruby
[21:24:56] SeepingN: has joined #ruby
[21:24:56] ponzii: phaul: So why am I seeing instance variables in main scope?
[21:25:30] phaul: they just become instance vars of main
[21:25:54] ponzii: phaul: Don't tell me it's another Ruby class << self solipsism :(
[21:26:04] devil_tux: has joined #ruby
[21:26:23] devil_tux: quick question, as a dev, what would you prefer: http://rubyfiddle.com/riddles/4d52f
[21:26:55] ponzii: phaul: In what sense can main be instantiated?
[21:26:56] devil_tux: for me, the 2nd snippet reads a bit uglier
[21:27:30] phaul: ponzii: it is an instance of class Object
[21:27:59] phaul: &>> @a = 1; [self, self.instance_variable_get :@a]
[21:28:02] rubydoc: # => (https://carc.in/#/r/60nc)
[21:28:07] al2o3-cr: &>> self.class
[21:28:08] rubydoc: # => Object (https://carc.in/#/r/60nd)
[21:28:22] rubydoc: # => main (https://carc.in/#/r/60ne)
[21:28:30] phaul: &>> @a = 1; [self, self.instance_variable_get(:@a)]
[21:28:31] rubydoc: # => [main, 1] (https://carc.in/#/r/60nf)
[21:28:34] ponzii: phaul: At which point I realise my suspicions about OOP were justified. I need to get back to procedural/functional programming.
[21:29:09] al2o3-cr: ponzii: yeah, ok.
[21:29:12] ponzii: phaul: So much of OOP is just needless complexity for zero gain.
[21:29:42] phaul: np. If that's how you feel, Im not trying to convince you otherwise
[21:29:43] ponzii: phaul: These are just senseless contortions.
[21:31:05] devil_tux: anyone might dropping their preffered version?
[21:34:16] phaul: devil_tux: definately second out of the two
[21:37:38] devil_tux: phaul: roger
[21:38:05] devil_tux: dunno what is wrong with me
[21:38:06] SeepingN: I like the rubyness of the 2nd, but like the similarity in the two possible outcomes for the 1st snip
[21:39:01] SeepingN: Q you have to wonder was consdiered or expected implicitly: if @instance << x fails somehow, then what does it do
[21:39:25] devil_tux: SeepingN: yea its needless `if` tbh
[21:39:39] devil_tux: just another tick to cpu
[21:39:51] devil_tux: but it reads so easier/cleaner for me
[21:40:00] SeepingN: something wonkyh happens to @instance and you fail to append "...", you get an exception.
[21:40:29] donofrio_: has joined #ruby
[21:41:19] sarink: has joined #ruby
[21:41:43] cd: has joined #ruby
[21:41:55] Hoffman: devil_tux: what is this function supposed to do?
[21:42:02] Hoffman: IE what data does it operate on
[21:43:15] devil_tux: Hoffman: I don't follow?
[21:43:58] devil_tux: its pretty self-explanatory
[21:44:02] leftylink: that `if @instance << x` seems deceptive if the expectation is that it will always be truthy. if it absolutely must be on one line, perhaps `false.tap { @instance << x}` instead?
[21:44:30] Hoffman: devil_tux: I mean it looks like you're using a bitwise operator to operate on strings
[21:44:43] leftylink: or I guess you can go all the way with the tapping, so `@instance.include?(x).tap { |b| @instance << x unless b }`
[21:44:52] phaul: &ri String#<<, Hoffman
[21:44:52] rubydoc: Hoffman: https://ruby-doc.org/core-2.6/String.html#method-i-3C-3C
[21:45:15] Hoffman: ah, I guess my documentation was outdated
[21:45:47] SeepingN: ahead = false
[21:46:37] devil_tux: leftylink: thats cool :)
[21:46:42] phaul: or be perly ( if it's even perly) on the last line: @instance << x and return false
[21:47:08] devil_tux: phaul: that works?
[21:47:19] devil_tux: isn't that read as AND operator
[21:47:38] devil_tux: ; might work
[21:47:42] phaul: no. use and
[21:47:45] phaul: that's the point
[21:47:59] SeepingN: "else" what
[21:48:20] leftylink: I'd prefer `;` in the situation. `and` is still implying that the truthiness of `@instance << x` matters
[21:48:23] leftylink: when we expect it to not
[21:48:28] SeepingN: returns nil, though more likely crashes with exception
[21:48:32] al2o3-cr: doesn't matter in that instance but whatever.
[21:48:39] SeepingN: I assumed it did matter
[21:49:01] phaul: and precedence is such it is meant to chain thing like do this and do that. && is meant to be used for &&ing booleans
[21:49:05] al2o3-cr: SeepingN: it doesnn't
[21:49:35] brandonkal: has joined #ruby
[21:52:30] al2o3-cr: SeepingN: you might be thinking of bitwise left shift.
[21:52:44] al2o3-cr: it's a method call.
[21:54:17] devil_tux: leftylink: good points
[21:55:01] al2o3-cr: devil_tux: just do what is readable.
[21:55:35] SeepingN: and correct
[21:57:55] phaul: going back to version 2. we haven't talked about why you disliked it.. To me that is the obvious solution
[21:59:58] leftylink: also since it was never explicitly stated... there *was* a bit of uncertainty about `@instance` but I suppose the assumption in most of my statements was that it was either an array or a string, therefore `<<` will always be truthy
[22:00:16] al2o3-cr: leftylink: wrong.
[22:00:54] devil_tux: leftylink: yeah, its array of strings
[22:01:12] phaul: but if it's not always truthy the two programs are not even doing the same!
[22:01:26] phaul: al2o3-cr: what's the example of falsey?
[22:02:10] phaul: &>> '' << '...'
[22:02:12] rubydoc: # => "..." (https://carc.in/#/r/60o0)
[22:02:26] SeepingN: &>> nil << '...'
[22:02:27] rubydoc: # => undefined method `<<' for nil:NilClass (NoMethodError) (https://carc.in/#/r/60o1)
[22:02:35] SeepingN: nil. gets you every time
[22:03:11] SeepingN: but that may or may not be a concern depending on the code and it's accessability by outside things
[22:04:28] rubydoc: Array#<<, Integer#<<, IO#<<, Method#<<, Proc#<<, Queue#<<, SizedQueue#<<, String#<<, CSV#<<, CSV::Row#<<, CSV::Table#<<, CSV::Writer#<<, Date#<<,...
[22:05:13] phaul: because obviously you want to append '...' to all those ( including nil )
[22:05:17] donofrio_: has joined #ruby
[22:05:51] al2o3-cr: phaul: obviously not.
[22:06:27] al2o3-cr: leftylink: i should of read your answer more clearly ;(
[22:06:40] leftylink: recall that for the given code to make sense we also have to intersect that set with the set of things that have `include?` ... also that I assumed that `includes?` in the original was misspelled
[22:07:36] jenrzzz: has joined #ruby
[22:08:22] al2o3-cr: leftylink: it still understandable. it was me flashing through it ;)
[22:09:04] al2o3-cr: still, @instance could of been anything.
[22:09:42] phaul: well, sometimes you don't formally establish the preconditions, just go with your gut feeling of what they probably meant
[22:10:06] al2o3-cr: phaul: i generally do.
[22:13:55] RedNifre: has joined #ruby
[22:14:17] s3nd1v0g1us: has joined #ruby
[22:15:22] venmx: has joined #ruby
[22:16:16] Hoffman: [16:46:42] phaul or be perly ( if it's even perly) on the last line: @instance << x and return false
[22:16:42] Hoffman: or last line !(@instance << x) :D
[22:16:49] Hoffman: oops devil_tux^
[22:16:59] phaul: yeah. and is more idiomatic there but don't do any of that
[22:17:11] Hoffman: in general though you have a boolean method with side effects
[22:17:19] lxsameer: has joined #ruby
[22:17:21] al2o3-cr: it's ruby do whatever you like :P
[22:17:23] Hoffman: which affects objects in-place
[22:17:30] Hoffman: so youd need the method to be skip!?
[22:17:58] Hoffman: no but maybe break it out into 2 methods to make it clear that the boolean method doesn't change objects in place, and the object-changing method doesnt need to return a boolean
[22:19:00] al2o3-cr: Hoffman: `a = [1,2,3,4]; a << a.shift' is that worthy?
[22:20:23] al2o3-cr: is that a bang?
[22:20:45] Hoffman: al2o3-cr: sorry, is this a separate question to devil_tux's?
[22:21:04] Hoffman: s/question/scenario/
[22:22:05] Hoffman: not sure what youre wondering when you mean worthy but the object being modified in-place would probably spur me to use a bang
[22:22:24] al2o3-cr: Hoffman: nm. ponzii
[22:22:56] Hoffman: I guess if it's all defined within the method, including a, it wouldnt use one
[22:24:07] phaul: Hoffman: bang does not mean self modifiying or destructive methods.
[22:25:14] Hoffman: oh I see what you are saying, yea you are right
[22:25:24] Hoffman: since its not modifying the args in place
[22:26:03] Hoffman: still, I am of the personal opinion that it shouldnt do that 1) because it's supposed to do nothing but return a boolean, and 2) I dont like side effects :P
[22:26:05] al2o3-cr: Hoffman: never args only objects.
[22:26:27] al2o3-cr: Hoffman: no booleans in Ruby.
[22:26:41] Hoffman: I beg your pardon?
[22:26:55] mat_bug: has joined #ruby
[22:26:58] Hoffman: Ruby doesn't have the concept of trueness or falseness?
[22:27:27] Hoffman: no matter how implemented, if so, it has booleans, theyre just implemented in one way or another
[22:27:42] devil_tux: leftylink: uh, not a Ruby per se :>
[22:27:42] Hoffman: I feel like this might be a semantic debate though
[22:28:02] donofrio_: has joined #ruby
[22:28:07] al2o3-cr: C as 0 or 1
[22:28:18] phaul: there are booleans, true and false. and apart from that values are either truthy and falsy
[22:29:10] al2o3-cr: no, no booleans
[22:29:29] Hoffman: al2o3-cr: well Ill leave it to you and phaul to work out, then
[22:29:35] phaul: al2o3-cr: you want to start the philosophical discussion of what it means to be a boolean. Ok what's the definition of a boolean
[22:29:43] Hoffman: seems like "no booleans" is an idiomatic phrase intended to confuse newbies
[22:29:58] al2o3-cr: Hoffman: ruby as baboons, only.
[22:30:35] phaul: Here's my definition: booleans are true and false and they exist in Ruby
[22:30:56] Hoffman: phaul: literally any representation of trueness or falseness, implemented in any way
[22:30:59] Hoffman: would be my 2c
[22:31:00] al2o3-cr: phaul: no, baboons only.
[22:34:09] al2o3-cr: oh, and lemurs ;)
[22:35:16] al2o3-cr: &>> true == false # baboons
[22:35:17] rubydoc: # => false (https://carc.in/#/r/60o4)
[22:35:41] al2o3-cr: so there you go Baboons.
[22:40:54] mat_bug: has joined #ruby
[22:44:15] sarink: has joined #ruby
[22:46:05] al2o3-cr: ACTION is hanging out with a baboon
[22:52:06] phaul: btw nil << '...' is not falsey
[22:52:24] phaul: it doesn't even run. That't not what falsey is
[22:53:17] donofrio_: has joined #ruby
[22:55:34] clemens3_: has joined #ruby
[22:55:56] mat_bug: has joined #ruby
[22:57:41] RiPuk: has joined #ruby
[22:59:05] al2o3-cr: phaul: true.
[22:59:31] krawchyk: has joined #ruby
[22:59:41] al2o3-cr: it raises as it should do.
[23:00:11] phaul: sure, in the heat of the discussion it was said as a falsey example. thats all
[23:01:14] al2o3-cr: phaul: i think they were simply implying if @instance was nil.
[23:01:38] phaul: in which case neither code works
[23:02:33] devil_tux: omg guyz u still discussing?
[23:02:49] devil_tux: classic #ruby :]
[23:03:00] jenrzzz: has joined #ruby
[23:03:05] SeepingN: look, answer, code for 10 minutes, repeat
[23:03:20] al2o3-cr: or any other object for that matter that doesn't respond to #<<
[23:03:49] Hoffman: debate is the heart of dialecticism and epistemology
[23:04:25] phaul: right. so from the which code is better you managed to conclude that the question was incomplete, and the methods are all broken. Congrats to all
[23:04:29] al2o3-cr: &>> :foo << :bar
[23:04:30] rubydoc: # => undefined method `<<' for :foo:Symbol (NoMethodError) (https://carc.in/#/r/60o5)
[23:05:26] havenwood: devil_tux: I don't like the idea of mutation in a predicate method.
[23:05:36] Nicmavr: has joined #ruby
[23:07:27] mat_bug: has joined #ruby
[23:10:31] donofrio_: has joined #ruby
[23:10:44] havenwood: devil_tux: Folk might be able to provide better suggestions if you can zoom out and show a bit more context around where that code s being used.
[23:12:19] Puffball: has joined #ruby
[23:13:42] phaul: he said it. he wants to append '...' to string arrays. its just that the channel is really found itself being pedantic on preconditions for instance variable values all of a sudden
[23:14:03] cnsvc: has joined #ruby
[23:16:56] jenrzzz: has joined #ruby
[23:18:33] havenwood: &>> class Symbol; def << other; to_proc << other.to_proc end end; [1, 2, 3].map &:abs2 << :abs2
[23:18:34] rubydoc: # => [1, 16, 81] (https://carc.in/#/r/60o6)
[23:19:52] mat_bug: has joined #ruby
[23:21:25] RedNifre: has joined #ruby
[23:22:56] RiPuk: has joined #ruby
[23:24:36] al2o3-cr: require 'fiddle'; include Fiddle; r = (1..10); include Fiddle; [16,24].zip([rand(100).__id__, rand(100).__id__]).each { |b, v| Pointer[dlwrap r][b] = v }; r
[23:24:47] al2o3-cr: &>> require 'fiddle'; include Fiddle; r = (1..10); include Fiddle; [16,24].zip([rand(100).__id__, rand(100).__id__]).each { |b, v| Pointer[dlwrap r][b] = v }; r
[23:24:48] rubydoc: # => 97..58 (https://carc.in/#/r/60o9)
[23:25:37] phaul: al2o3-cr: you really are the fiddling wizzard :) now iterate it
[23:25:58] havenwood: al2o3-cr: maybe also randomly frozen and tainted
[23:26:18] havenwood: and exlcude_end for good measure
[23:26:38] Hoffman: al2o3-cr: what does including Fiddle twice do
[23:26:45] al2o3-cr: havenwood: based on your snippet :)
[23:26:51] havenwood: al2o3-cr: :)
[23:27:26] al2o3-cr: Hoffman: requiring the lib, then including the module.
[23:27:47] phaul: you have double include
[23:28:06] Hoffman: I wasnt sure if it was some neat quirk with redefining stuff or something
[23:28:07] al2o3-cr: oh, shit so i do :(
[23:28:09] Hoffman: or just a simply typo
[23:31:06] al2o3-cr: first 16 bytes are always RBasic.
[23:32:22] al2o3-cr: so doing obj.object_id is where it is memory.
[23:33:07] al2o3-cr: anyway i'm watching snooker now ;)
[23:36:43] al2o3-cr: selby or ronnie for sure.
[23:38:50] mat_bug: has joined #ruby
[23:39:04] phaul: I was rooting for Ronnie for a long time, but these days I'm less interested in snooker.. two much depends on a single bad or unfortunate shot. usually there is no coming back at top level
[23:39:45] donofrio_: has joined #ruby
[23:40:02] al2o3-cr: phaul: the talent these days are unblievable.
[23:41:12] sgen: has joined #ruby
[23:46:22] al2o3-cr: havenwood: good!
[23:46:57] al2o3-cr: selby is awesome!!
[23:53:25] mat_bug: has joined #ruby
[23:53:32] al2o3-cr: &>> require'fiddle'; a = {}; Fiddle::Pointer[Fiddle.dlwrap a].to_s == Fiddle::Pointer[a.object_id<<1].to_s
[23:53:32] rubydoc: # => true (https://carc.in/#/r/60oa)
[23:56:31] al2o3-cr: 133 break, magnificient