#ruby - 08 December 2017
« Back 1 day Forward 1 day »
[00:25:34] Synthead: when I do a Set.new.tap and do a little loop to add things to it, the Set comes back empty
[00:25:51] Synthead: if I stick a binding.pry in the block, I can see that the Set is being populated, though
[00:27:11] ruby[bot]: Please provide us with an example of valid input for your problem, the output that you're getting, and the output that you were expecting.
[00:59:56] havenwood: Synthead: It seem you're expecting #tap to work like #yield_self is going to in Ruby 2.5
[03:15:02] beaorn: trying to determine best way to limit a specific queue to a max number of workers
[08:44:41] elisaado: Hey, anyone know a good sound library? The main thing I want to do is write tones to a file
[09:39:29] KrzaQ: What is the gem I should use for grammar parsing? I used to play with Citrus, but it seems to be abandoned, and returns a string instead of a match tree when I call its parse method
[10:52:21] ar: so, i wanted to create a binding for eval which would pretend that every variable exists, and - unless set otherwise - has a default value of 0 (kind of like Hash.new(0), but that's a hash, not a binding)
[10:54:37] ar: is there a way to do that? i tried creating my own class deriving from binding, but that didn't work. and neither did replacing the Binding#local_variable* methods with define_singlethon_method on the object i got
[12:12:37] apeiros: since lvars and methods are syntactically indistinguishable (that is, if you use the method without arg/block)
[12:34:57] apeiros: ar: https://github.com/apeiros/directory_template/blob/master/lib/directory_template/erb_template.rb look for the Variables class
[12:35:23] apeiros: I'm not sure it's the latest iteration I've written of that class, but it should still suffice as an example
[13:09:34] tobiasvl: elisaado: https://weechat.org/files/doc/devel/weechat_faq.en.html#filter_irc_join_part_quit
[13:16:38] dminuoso: elisaado: The reason is if theres a part/join directly around the time someone speaks, those join/quit will be displayed.
[14:00:01] norm: Is there a way to instance_eval a method defined in a module? Here’s what I’m trying to do… https://gist.github.com/anonymous/7670038bce5a601bacc692a626038cad
[14:04:45] norm: Unfortunately, yes. Let me make my gist a little closer to what I’m actually doing ...
[14:06:13] NL3limin4t0r: If you don't want to clutter the Student class you can extend the instance: `Student.new.extend(ExtraMethods).print_age`
[14:06:58] norm: I’m mocking up a way to register/unregister functionality on an object, like this https://gist.github.com/anonymous/e6f0c6a0dfed46ebc452e6a3d16bb7aa
[14:07:40] norm: in reality, a little more complicated than that contrived example. But basically, each plugin is a module that provides a register/unregister method, which would be instance_eval’d on the object receiving the plugin
[14:09:23] NL3limin4t0r: If the method isn't private I would use #extend to extend the instance and call the method after extending.
[14:10:33] norm: oh, since every time you extend, you’re overwriting the previous plugin’s register/unregister method?
[14:11:02] norm: i seem to remember that ‘extends’ actually adds a layer to the object’s inheritance rather than overwrites methods. it’s been a while since i read ‘metaprogramming ruby’
[14:12:34] NL3limin4t0r: If you extend multiple modules they all get added to the same instance singleton class, overwriting methods already present there.
[14:18:58] NL3limin4t0r: Norm: If you don't want to add the methods to the instance you can #dup or #clone first. However if you do this the attribute of your original object are not effected.
[14:26:08] NL3limin4t0r: Ah, elomatreb got me an idea, maybe you can do p.instance_eval(& ExtraMethod.instance_method(:print_age))
[14:35:44] elomatreb: You either 1. have it do that somewhere in your dotfiles/shell-rc files or 2. you installed that addon that auto switches based on .ruby-version files in directories
[17:04:54] bud_spencer: Is there native Ruby implementation that has GIL, which allows also cpu bound tasks, as it is possible with Python, where after some ticks tasks are switched when doing something cpu intensive?
[17:17:37] havenwood: bud_spencer: Like the Python GIL, the CRuby one doesn't block certain types of operation. They both use a real system thread for scheduling. As far as I know Ruby has had this since Ruby 1.9.
[17:18:40] havenwood: bud_spencer: Upcoming possible things on the horizon for Ruby are Thribers and Guilds.
[17:21:57] bud_spencer: havenwood: I tried week ago RoR server with some Japanesse name (don't remember right now) and infinite loop blocked all other web requests
[17:37:44] elomatreb: The former has a default value and is thus optional, whereas the latter is required and calling the method without it will raise an error
[17:41:19] WhereIsMySpoon: Yo! So I'm trying to use Gosu on ubuntu, and I'm getting 'Assertion pthread_mutex_unlock failed at pulsecore/mutex-posix'... blah, when trying to use sound specifically
[17:45:36] pragmatism: elomatreb but the argument in `def foo(bar: bar)` is a variable, not a default.
[18:37:03] WhereIsMySpoon: Anyone know how to make ocra bundle up my app that uses curses into an exe?
[18:37:24] WhereIsMySpoon: If i try ocra myscript.rb it runs my script which loads up my game in the console and curses takes over lol
[19:18:51] rubycoder37: xmas is coming soon and looks like a new ruby version will be released, I couldn't be happier
[19:23:30] elomatreb: I feel like this was probably answered here a lot already, but I couldn't find it: A friend is asking for a simple Ruby open source app to see how Ruby is used in the real world, but all I could think of were either very complex, very specific, or Rails applications
[19:32:32] dminuoso: elomatreb: Just take gitlab, there's gajillion pieces that are not rails related.
[19:35:04] rubycoder37: any ideas how I can make this test better? https://gist.github.com/anonymous/ca3b854467399d66bf2876631b0a8a99
[19:39:44] rubycoder37: here's the code: https://gist.github.com/anonymous/1f2c3a0096a0f645b44b39e4efb5b06f
[20:22:25] elomatreb: dminuoso: Sorry, was away. I showed them Homebrew, thank you for the idea. The problem with Rails was that they said they felt like they didn't understand the complexity, they specifically asked me for a non-rails project
[20:40:44] chrisgopher: As a junior dev, what should I do when seniors have been arguing about fuzzy searches and trigrams for 2 hours |:
[20:46:41] Papierkorb: Or listen to grab some keywords, maybe there's something interesting to google about
[20:57:17] chrisgopher: Sitting next to me, it began as a convo about making it more accurate. However now, I think its gotten a little out of hand
[21:01:18] baweaver: Then threads may not be a good idea. Have you looked into Sidekiq or other job servers?
[21:04:39] dminuoso: chrisgopher: If you cant understand anything, plug in headphones and do something productive with your time. :-)