« Back to channel list

#ruby - 04 September 2017

« Back 1 day Forward 1 day »
[00:02:43] moei: has joined #ruby
[00:04:14] edward__: has joined #ruby
[00:06:09] edward__: Anyone working on anything right now?
[00:11:39] 7GHAAG92P: has joined #ruby
[00:11:39] paradisaeidae: has joined #ruby
[00:12:19] andywojo: has joined #ruby
[00:12:28] Radar: edward__: probably
[00:12:56] Radar: I was working on a gnarly CSV importer issue on Friday, but today I am planning out a junior engineering program at where I work
[00:15:03] weaksauce: has joined #ruby
[00:15:11] imode: working on an e-commerce site with sinatra and redis.
[00:21:37] nicesignal: has joined #ruby
[00:21:54] bruno-: has joined #ruby
[00:28:09] nadir: has joined #ruby
[00:53:12] imode: has joined #ruby
[01:04:34] Puffball: has joined #ruby
[01:04:51] konsolebox: has joined #ruby
[01:07:47] pi4: has joined #ruby
[01:08:44] ramfjord: has joined #ruby
[01:08:45] ramfjord_: has joined #ruby
[01:09:33] cadillac_: has joined #ruby
[01:14:01] bronson: has joined #ruby
[01:15:41] AxelAlex: has joined #ruby
[01:18:56] enterprisey: has joined #ruby
[01:19:45] mtkd: has joined #ruby
[01:21:09] kreantos: has joined #ruby
[01:26:38] tamouse__: that's cool, radar
[01:26:55] neo95: has joined #ruby
[01:27:13] Radar: So very cool :D
[01:29:28] nicesignal: has joined #ruby
[01:34:41] _sfiguser: has joined #ruby
[01:36:03] dreamthese: has joined #ruby
[01:38:20] numbdewd: has joined #ruby
[01:44:27] dreamthese: has joined #ruby
[01:44:41] dreamthese: has left #ruby: ()
[01:45:35] 18VAB36IN: has joined #ruby
[01:45:38] paradisaeidae: has joined #ruby
[01:47:39] dreamthese: has joined #ruby
[01:50:33] Jameser: has joined #ruby
[01:53:27] Azure: has joined #ruby
[01:53:50] davic_: has joined #ruby
[01:55:13] ovaltine: has joined #ruby
[01:57:15] hutch34: has joined #ruby
[02:01:32] d^sh: has joined #ruby
[02:01:56] gizmore: has joined #ruby
[02:23:37] hutch34: has joined #ruby
[02:35:58] brent__: has joined #ruby
[02:39:42] hutch34: has joined #ruby
[02:44:37] tacoboy: has joined #ruby
[02:49:46] nicesignal: has joined #ruby
[02:51:01] nicesignal: has joined #ruby
[02:51:34] sarbs: has joined #ruby
[02:51:49] ahrs: has joined #ruby
[02:52:24] nicesignal: has joined #ruby
[02:56:31] agent_white: has joined #ruby
[02:56:50] AxelAlex: has joined #ruby
[02:58:57] goyox86: has joined #ruby
[03:00:08] cadillac_: has joined #ruby
[03:00:38] goyox86_: has joined #ruby
[03:00:49] goyox86_: has left #ruby: ()
[03:01:52] imode: has joined #ruby
[03:01:59] goyox86_: has joined #ruby
[03:09:53] orbyt_: has joined #ruby
[03:13:19] nobody: has joined #ruby
[03:13:24] nobody: anyone here?
[03:13:40] nobody: I really need an answer to this question
[03:13:40] nobody: https://stackoverflow.com/questions/46020885/modify-rake-task-at-test-runtime
[03:13:52] umaaji: has joined #ruby
[03:14:49] nobody: will give $20 cash if someone gets it
[03:14:59] nobody: just message me directly
[03:15:04] bronson: has joined #ruby
[03:17:08] Radar: nobody: paypal.me/ryanbigg
[03:17:35] Radar: nobody: https://gist.github.com/radar/f3fa097cd1ade88e0defd909ffc80980 This code goes into your Rake task.
[03:18:02] Radar: That will redefine the methods for _all_ instances of Foo.
[03:18:37] Radar: Updated the Gist to show an example of overriding the method on just one instance.
[03:19:02] Radar: Looking forward to your payment shortly.
[03:19:11] Radar: Oh but I am
[03:19:13] agent_white: Radar Wayne unholstered.
[03:19:40] imode: https://ptpb.pw/Hg5N/ruby have fun, nobody.
[03:19:49] nobody: the rake task is defined, the test take is invoked. and I have no reference to the instance itself
[03:19:52] Radar: imode: what's with the return?
[03:20:04] imode: Radar: personal style. idgaf if anybody uses it.
[03:20:11] Radar: imode: I believe rubocop would complain about it.
[03:20:20] imode: Radar: don't really care, tbf.
[03:20:23] Radar: nobody: it would help if you would give a more concrete example.
[03:20:30] Radar: This foo + bar thing never helps anyway
[03:20:47] nobody: ok, let me modify my question on stackoverflow
[03:20:49] Radar: imode: I should've used the def <instance>.bar stuff. Silly mistake.
[03:20:55] nobody: i will raise the bounty to $50 also
[03:21:02] imode: rather than creating a metaclass.
[03:21:03] Radar: Brain oozing out my ear from reviewing all these applications today.
[03:21:07] Radar: imode: indeed
[03:21:39] imode: nobody: rather than creating a metaclass, you can take a look at that ptpb link. you can just define new methods on the fly for instances, much like you can in prototypical languages such as javascript.
[03:21:44] kreantos: has joined #ruby
[03:21:50] imode: also, just ask a question next time. :P
[03:21:55] Radar: imode: They said that they don't have any reference to the instance itself.
[03:22:07] Radar: imode: also: happy to share the bounty with you if they pay up.
[03:22:13] imode: nah I'm good.
[03:22:17] Radar: :ok_hand:
[03:22:27] nobody: i will pay up, this is a pretty high priority ask... trust me
[03:22:59] imode: so you have no access to the instance.. hrm.
[03:23:20] Radar: nobody: well I was always taught "trust nobody" and now I guess that particular prophecy is coming true.
[03:30:30] __Yiota: has joined #ruby
[03:31:41] nobody: https://stackoverflow.com/questions/46020885/modify-rake-task-at-test-runtime
[03:31:56] nobody: hope this is a bit more clear
[03:32:36] imode: you could probably replace Foo.new with an anonymous class redefinition of foo.
[03:33:15] imode: oh, during the "test" task.
[03:34:15] imode: nobody: do you actually have access to this source? because you can just open up foo again at the top of the file.
[03:34:53] imode: but I'm also assuming you want it to be temporary.
[03:35:35] nobody: the thing is that im writing a test for particular class. and one particular value needs to be changed everytime the test runs. so, i have a method called setup_test... and I use the output of that method to override a particular method
[03:35:53] imode: lemme whip something up.
[03:38:06] hutch34: has joined #ruby
[03:44:17] gix: has joined #ruby
[03:44:39] segy: has joined #ruby
[03:46:37] pharma_joe: has joined #ruby
[03:47:54] Radar: nobody: what testing framework are you using?
[03:48:12] Radar: and can you share with us what setup_test is?
[03:49:39] tamouse__: something smelly
[03:50:22] imode: yeah why would you need to do this.
[03:50:27] imode: what stops you from just grabbing an instance?
[03:51:19] nobody: sorry i just stepped away
[03:51:40] SteenJobs_: has joined #ruby
[03:51:43] Radar: nobody: y u no mock the value using RSpec?
[03:53:51] nobody: let me think for a second
[03:54:25] imode: so I have something rough.
[03:54:37] imode: just need to work it into a oneliner.
[03:54:39] Radar: nobody: Also, I'm thinking that you're running the rake task as a part of your RSpec testing, possibly using something like `rake something`?
[03:55:02] Radar: If so: Why do it that way? Why not abstract the logic out to a class and then test that within the RSpec test? Have the rake task just be light and call that class + method directly?
[03:56:44] nobody: i could do that, but the rake tasks are pretty nasty and overly complicated, it isn't trivial to abstract the logic out of it... if that makes sense...
[03:56:57] pharma_joe: has joined #ruby
[03:57:52] nicesignal: has joined #ruby
[03:58:37] imode: change your Foo.new to...
[03:58:38] nobody: setup_test is basically setting up some infrastructure stuff
[03:58:40] imode: proc {x = Foo.new; y = class << x; self; end; y.send(:define_method, :bar){2}; x}.call
[03:58:57] imode: there's probably a better way to do that.
[03:59:31] Radar: nobody: At this rate it sounds like it'd be worth hiring a consultant for an hour and getting them to look at your code.
[03:59:40] imode: https://ptpb.pw/COPL/ruby
[03:59:45] imode: a full example.
[04:01:06] nobody: im open to the option of hiring a consultant, i don't know how to go about by that... i can send some emails around and share the actual code there
[04:02:54] imode: dur. https://ptpb.pw/tTOe/ruby better version.
[04:04:04] imode: nobody: this way you can always generate modified instances of "Foo" to pass to your something task. if you really want to do it this way.
[04:04:27] nobody: im looking at it, just a sec
[04:06:48] imode: pretty much just uses the same syntax as earlier, but wrapped in a proc that you can call to get a new instance. if you really want to make it prettier, define a dedicated function to for getting new modified Foo instances.
[04:08:01] nobody: I am not sure if I follow... do I do this during the setup_test part? or when I define the rake task
[04:08:33] imode: under your task :something.
[04:08:41] imode: InvokeSomething(Foo.new)
[04:08:56] imode: you want that instance of Foo to be modified to return 2 when 'bar' is called, right?
[04:09:10] claw: has joined #ruby
[04:10:03] imode: if so, then just replace the Foo.new beside InvokeSomething with that proc+call I defined on line 10.
[04:10:25] imode: InvokeSomething will be passed an instance of Foo with its 'bar' method modified to return 2. all other instances will be unaffected.
[04:10:45] MarkBilk: has joined #ruby
[04:11:04] imode: not really sure why you can't just plop down a foo = Foo.new; prior to InvokeSomething, but go figure.
[04:11:08] s00pcan: has joined #ruby
[04:11:30] nobody: wait, maybe I wasn't clear.. but the value for bar will be determined during setup_test
[04:11:46] imode: where is setup_test? I don't use rake.
[04:12:24] nobody: sorry for confusion, I just modified the question again
[04:12:25] nobody: https://stackoverflow.com/questions/46020885/modify-rake-task-at-test-runtime
[04:12:46] umaaji: has joined #ruby
[04:13:15] imode: o..kay. so you want all instances generated after setup_test to be created with the modified bar method, and after 'rake something', you want to go back to the original version.
[04:13:19] imode: am I correct on that.
[04:13:39] orbyt_: has joined #ruby
[04:13:41] imode: are you able to modify your something task.
[04:13:49] imode: as in, the source for it.
[04:13:52] nobody: yeah I can
[04:13:56] imode: okay. do this.
[04:14:11] nobody: to a certain extent that is
[04:14:18] imode: and that certain extent is..?
[04:14:32] nobody: can't modify InvokeSomething
[04:14:49] imode: you can't modify the actual definition of InvokeSomething or the call to InvokeSomething.
[04:14:56] nobody: definition
[04:15:00] imode: that's.. fine.
[04:15:22] imode: https://ptpb.pw/bpD2/ruby
[04:15:23] nobody: thanks for helping me out btw, i appreciate it
[04:15:33] imode: can you do this?
[04:16:15] ornerymoose: has joined #ruby
[04:17:34] imode: now, if any Foos are instantiated inside InvokeSomething's definition, they will not be affected, but I assume that doesn't matter because you're passing a new foo into InvokeSomethig anyway.
[04:18:51] nobody: I might be able to
[04:19:28] imode: try it and get back to me. you can define any method you want to on any class instance via def <your_variable_here>.<your_method_name>() <method_body>; end
[04:19:43] cadillac_: has joined #ruby
[04:20:55] nobody: that's cool. that gave me an idea. i would have see if this is possible. the only thing is that i was hoping to modify the rake task during invokation of another rake task, but im guessing that's not trivial
[04:21:45] imode: modifying a class definition and undoing it within a method is.. hm.
[04:21:50] imode: give me a moment.
[04:22:36] ramfjord: has joined #ruby
[04:22:37] ramfjord_: has joined #ruby
[04:23:47] imode: https://ptpb.pw/bYpV/ruby
[04:23:47] armando: has joined #ruby
[04:25:25] imode: so you can clearly see that I'm using the same method definition, yet I'm actually modifying the global class definition rather than individual instances.
[04:28:28] nobody: didn't know you could do that
[04:28:35] imode: welcome to ruby metaprogramming. :P
[04:29:13] imode: so you don't have to mess with your rake tasks.
[04:29:39] imode: you can just plop the Foo.send stuff in your do_some_testing method or wherever, just prior to when you invoke the "something" task.
[04:30:49] ShalokShalom: has joined #ruby
[04:31:58] imode: you could wrap those calls in a method so you wouldn't have to do send every time.
[04:34:54] uZiel: has joined #ruby
[04:35:02] agent_white: has joined #ruby
[04:35:54] imode: ACTION ponders a way to make that prettier.
[04:39:24] lexruee: has joined #ruby
[04:45:59] howdoi: has joined #ruby
[04:49:46] xco: has joined #ruby
[04:56:42] paradisaeidae: has joined #ruby
[04:58:01] belmoussaoui__: has joined #ruby
[04:58:40] imode: https://ptpb.pw/cRxg/ruby blorp.
[05:00:43] paradisaeidae_: has joined #ruby
[05:06:57] s00pcan: has joined #ruby
[05:11:47] imode: I could probably extend that to take a hash, map over the keys and values, yield, then map over them again to restore the original methods.
[05:16:06] bronson: has joined #ruby
[05:21:06] nobody: imode, interesting
[05:21:39] nobody: meta-magic-programming
[05:28:01] bruno-_: has joined #ruby
[05:30:01] paradisaeidae: has joined #ruby
[05:30:10] paradisaeidae_: has joined #ruby
[05:31:15] imode: https://ptpb.pw/lnS7/ruby well, it's a start.
[05:32:04] mark_on_the_moon: has joined #ruby
[05:32:20] mark_on_the_moon: has joined #ruby
[05:34:13] Joufflu: has joined #ruby
[05:35:53] vondruch: has joined #ruby
[05:39:03] imode: you could get by by storing the methods that are missing in a list, then checking if the method name is in that list. if so, just nix it.
[05:39:07] imode: rather than swapping it out.
[05:39:16] imode: this way you could add new definitions alongside old ones.
[05:40:56] fullstack: has joined #ruby
[05:41:23] vondruch: has joined #ruby
[05:45:00] imode: https://ptpb.pw/nCAn/ruby yay, you can take new definitions now.
[05:54:15] anisha: has joined #ruby
[05:56:05] mkali: has joined #ruby
[05:56:40] aupadhye: has joined #ruby
[05:56:52] Macaveli: has joined #ruby
[05:57:03] zenspider: no reason to exit if it isn't a class
[05:59:50] imode: meh. valid point.
[06:03:21] zenspider: something like: o = o.singleton_class unless o.is_a? Module
[06:03:40] alex``: has joined #ruby
[06:10:05] paranoicsan: has joined #ruby
[06:10:33] MrBusiness3: has joined #ruby
[06:10:42] ahrs: has joined #ruby
[06:10:45] govg: has joined #ruby
[06:11:34] snickers: has joined #ruby
[06:11:45] anas: has joined #ruby
[06:11:49] SeepingN: has joined #ruby
[06:13:48] leonthemisfit: has joined #ruby
[06:13:48] leonthemisfit: has joined #ruby
[06:13:55] rikai: has joined #ruby
[06:14:15] Roa: has joined #ruby
[06:16:09] eckhardt: has joined #ruby
[06:17:59] mark_on_the_moon: has joined #ruby
[06:18:30] inukshuk: has joined #ruby
[06:19:40] mark_on_the_moon: has joined #ruby
[06:20:45] xco: has joined #ruby
[06:22:19] roshanavand: has joined #ruby
[06:25:07] MrBismuth: has joined #ruby
[06:29:58] andikr: has joined #ruby
[06:37:29] xco_: has joined #ruby
[06:38:18] ramortegui: has joined #ruby
[06:41:27] Pisuke: has joined #ruby
[06:42:42] enterprisey: has joined #ruby
[06:43:00] conta: has joined #ruby
[06:43:27] Ishido: has joined #ruby
[06:44:10] CrazyEddy: has joined #ruby
[06:52:31] fullstack: has joined #ruby
[06:55:46] nrdb: has joined #ruby
[06:56:36] TomyWork: has joined #ruby
[06:59:56] neo95: has joined #ruby
[07:00:51] SteenJobs_: has joined #ruby
[07:03:33] alex```: has joined #ruby
[07:05:46] houhoulis: has joined #ruby
[07:06:07] CrazyEddy: has joined #ruby
[07:07:12] roshanavand: has joined #ruby
[07:12:37] mtkd: has joined #ruby
[07:15:13] Mon_Ouie: has joined #ruby
[07:16:54] bronson: has joined #ruby
[07:17:17] anisha_: has joined #ruby
[07:17:42] Guest40: has joined #ruby
[07:18:00] SeepingN: has joined #ruby
[07:18:09] Guest40: has joined #ruby
[07:18:41] claudiuinberlin: has joined #ruby
[07:18:56] Guest40: has joined #ruby
[07:19:41] aihwh: has joined #ruby
[07:19:45] Guest40: has joined #ruby
[07:20:00] aihwh: hello everyone, I have a problem with an array in Ruby
[07:20:33] Guest40: has joined #ruby
[07:20:48] imode: aihwh: ask and ye shall receive an answer!
[07:20:51] aihwh: https://pastebin.com/xpXN5FcH this is the array
[07:20:57] aihwh: and in a sec i'll paste my function
[07:20:57] ruby[bot]: aihwh: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/8bc1e57f0ddbc020bae1bb93ca549556
[07:20:57] ruby[bot]: aihwh: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[07:21:22] Guest40: has joined #ruby
[07:21:29] imode: alright, so this is a hash, not an array.
[07:21:33] imode: rather, a hash of hashes.
[07:22:04] aihwh: function: https://pastebin.com/ZaTVQDRH sorry for not uploading to git
[07:22:05] ruby[bot]: aihwh: as I told you already, please use https://gist.github.com
[07:22:06] tAn: has joined #ruby
[07:22:07] aihwh: imode: hm, yes
[07:22:30] aihwh: whenever i try to run the ruby script I get this error: `get_market_summary': undefined method `blank?' for nil:NilClass (NoMethodError)
[07:22:54] aihwh: i searched on Google and unique solution to this do not exists
[07:23:24] aihwh: but from what i've read, i understood it is related probably with (deprecated?) ruby versions? and i shall use "try" / "present?" instead?
[07:23:37] imode: aihwh: there's not much I can say without more code. for example, I need to see get_url and call_api.
[07:23:38] aihwh: to use data from that hash
[07:24:17] aihwh: imode: oki, hold up a sec
[07:24:42] aihwh: this is get_url https://pastebin.com/gXW5bh72
[07:24:43] ruby[bot]: aihwh: as I told you already, please use https://gist.github.com
[07:25:51] aihwh: here it is: https://gist.github.com/anonymous/41df3711ce6288de8ff77fe4bb6b4884 call-api
[07:25:54] vondruch: has joined #ruby
[07:26:06] aihwh: just reinstalled a new version of manjaro and keyboard layout isn't set
[07:26:11] aihwh: it's underscore, not "-"
[07:26:29] guille-moe: has joined #ruby
[07:26:51] fabio_ros: has joined #ruby
[07:27:56] PacificSalmon: sorry. but first pastebin has no reference to get_market_summary. the gist is different code. can you paste one contained example to gist please
[07:28:53] PacificSalmon: URIs[params[:api_type].to_sym][params[:action].to_sym]
[07:29:04] PacificSalmon: to_sym on dynamic/user input
[07:29:13] mark_66: has joined #ruby
[07:29:21] aihwh: PacificSalmon: https://gist.github.com/anonymous/3d1c5fd2af37b454a86d8f01fb267b98 sorry about that
[07:29:32] aufi: has joined #ruby
[07:29:46] PacificSalmon: on ruby 1.9 it's a security problem. on ruby 2.X+ (dont know what point release) it's less of a problem but still not a good idea
[07:30:06] aihwh: i see, thanks for the heads up, i'll modify
[07:30:11] PacificSalmon: where does the NoMethodError come from
[07:30:31] tvw: has joined #ruby
[07:30:34] aihwh: script.rb:147:in `get_market_summary': undefined method `blank?' for nil:NilClass (NoMethodError)
[07:31:22] vondruch: has joined #ruby
[07:31:45] PacificSalmon: sorry i dont know. you don't call that method specifically. and get_api is still on pastebin. if you want the best help then don't make it so hard to read your code
[07:32:19] claudiuinberlin: has joined #ruby
[07:32:53] aihwh: hm, PacificSalmon: what do you mean get_api?
[07:32:55] aihwh: call_api?
[07:33:06] imode: aihwh: show us where blank? is called.
[07:33:12] PacificSalmon: here there is call to get_url: https://gist.github.com/anonymous/3d1c5fd2af37b454a86d8f01fb267b98 then get_url is on the pastebin
[07:33:18] PacificSalmon: it's confusing
[07:33:45] Mon_Ouie: has joined #ruby
[07:34:21] aihwh: https://gist.github.com/anonymous/ac6ca416289fc5b99a5efc005884d1a8 here is get_url
[07:34:53] burgestrand: has joined #ruby
[07:34:56] aihwh: imode: i don't understand..
[07:35:10] PacificSalmon: thanks but issue is none of these examples call .blank?, & your examples aren't standalone. you are making it very diffilcult to help you
[07:35:43] aihwh: i'm sorry :)
[07:35:46] PacificSalmon: it's most likely a simple 1 line fix
[07:35:54] aihwh: i've modified the script..
[07:36:00] aihwh: PacificSalmon: probably
[07:36:05] aihwh: it's not .blank?
[07:36:11] aihwh: it's .first
[07:36:23] aihwh: reuploading again
[07:36:59] aihwh: PacificSalmon: let me upload the whole code
[07:37:07] imode: yes please.
[07:37:12] PacificSalmon: even stacktrace
[07:37:24] PacificSalmon: stacktrace would be very useful
[07:37:39] aihwh: https://gist.github.com/anonymous/de65878978336172f2f23d5e40362540
[07:37:58] aihwh: require "bittrex" is not mandatory
[07:38:03] PacificSalmon: summary = call_api(market_summary_url).first
[07:38:08] aihwh: you don't have to download it
[07:38:09] PacificSalmon: call_api is returning nil
[07:38:12] aihwh: PacificSalmon: yes, that's the problem...
[07:38:17] aihwh: it's returning a false value
[07:38:20] aihwh: but everything seems to be ok
[07:38:22] armyriad: has joined #ruby
[07:38:29] PacificSalmon: parsed_body["result"] if parsed_body["success"]
[07:38:38] PacificSalmon: parsed_body["success"] is probably false
[07:38:48] PacificSalmon: so nil is being returned silently there
[07:39:02] aihwh: let me show you the whole error
[07:39:21] PacificSalmon: you should fix call_api
[07:39:28] PacificSalmon: all your code expects it to not return nil
[07:39:38] aihwh: https://gist.github.com/anonymous/29a84e2f289969d8bbec8b711d5dd5ef
[07:39:39] PacificSalmon: raise an error, see why it failed
[07:40:07] supriyanto: has joined #ruby
[07:40:20] armyriad: has joined #ruby
[07:40:36] aihwh: if clicking on that link and add a comma
[07:40:41] aihwh: you will see the output is false
[07:40:51] PacificSalmon: your API call has failed
[07:40:51] aihwh: if clicking on without the comma, output > true
[07:40:58] PacificSalmon: you need to handle that
[07:41:14] aihwh: i'm on it
[07:46:26] dionysus69: has joined #ruby
[07:47:26] huyderman: has joined #ruby
[07:47:31] FahmeF: has joined #ruby
[07:48:06] aihwh: url = BASE_URL + URIs[params[:api_type].to_sym][params[:action].to_sym]
[07:49:01] Bish: has joined #ruby
[07:49:04] aihwh: what if get_url is actually the one with problems?
[07:49:08] aihwh: PacificSalmon: imode
[07:49:21] aihwh: can't see anything wrong for call_api
[07:52:34] PacificSalmon: follow this path: L251 => L147. L147 is where you fail. It's because call_api is returning nil, since result['success'] is false. it's not really a ruby problem. you are not using their API properly. but you should raise an error instead of silently returning nil. so you can easily see the problem.
[07:53:12] PacificSalmon: >> "1" if false
[07:53:14] ruby[bot]: PacificSalmon: # => nil (https://eval.in/854793)
[07:53:21] PacificSalmon: you're doing that.
[07:53:27] aihwh: i understand..
[07:55:07] xall: has joined #ruby
[07:55:27] ovaltine: has joined #ruby
[07:56:00] aihwh: PacificSalmon:
[07:56:04] aihwh: puts (parsed_body["success"] ? "Success".green : "Failed".red)
[07:56:19] aihwh: it is scraping the body of https://bittrex.com/api/v1.1/public/getmarketsummary?market=BTC-BAT
[07:56:22] aihwh: https://bittrex.com/api/v1.1/public/getmarketsummary?market=BTC-BAT,
[07:56:28] aihwh: click on the second link to see it failing
[07:56:48] matthewd: aihwh: Change your script to introduce a deliberate error
[07:56:49] PacificSalmon: both work for me
[07:57:04] aihwh: PacificSalmon: second one? add a comma to it at the end of link
[07:57:20] PacificSalmon: ah. yeah. fails
[07:57:34] aihwh: i think the problem is with get_url
[07:58:21] kreantos: has joined #ruby
[07:58:30] matthewd: If the file you're looking at isn't calling #blank?, and the error is complaining about code calling #blank?, ISTM the most likely explanation is that you aren't looking at the same code that's being executed
[07:58:47] PacificSalmon: ` puts (parsed_body["success"] ? "Success".green : "Failed".red)` it's not a good idea. you should raise an exception, then when handling the exception in a rescue block, print a message like that. the point is you may you not be able to continue because of this error. so printing a message, then continuing is not solving the issue. you'll just run into a weirder error later.
[07:59:36] CustosLimen: has joined #ruby
[08:00:03] aihwh: oh, i need 5 minutes to clear my head, then i'll look into some documentation
[08:00:40] aihwh: thank you :)
[08:01:08] dionysus69: has joined #ruby
[08:03:21] charliesome: has joined #ruby
[08:04:40] mikecmpbll: has joined #ruby
[08:10:35] frozengeek: has joined #ruby
[08:13:21] Mon_Ouie: has joined #ruby
[08:16:14] ams__: has joined #ruby
[08:18:03] mim1k: has joined #ruby
[08:23:44] aihwh: PacificSalmon:
[08:24:00] aihwh: Fetching Market Summary...
[08:24:00] aihwh: ["https://bittrex.com/api/v1.1/public/getmarketsummary?market=BTC-BAT,", {"success"=>false, "message"=>"INVALID_MARKET", "result"=>nil}]
[08:24:08] aihwh: so the error appears in call_api
[08:24:13] tomphp: has joined #ruby
[08:24:25] aihwh: i have a q: is the comma added to the link a normal thing in ruby?
[08:25:45] aihwh: matthewd:
[08:26:32] tomphp: has joined #ruby
[08:26:40] aihwh: what if is added here because of the hashes?
[08:28:20] matthewd: I'm not interested in debugging code you haven't convinced me matches what you're running
[08:29:54] frozengeek: has joined #ruby
[08:29:55] aihwh: ok, could you explain me how to use raise Exception for handling errors instead of printing messages?
[08:30:16] paranoicsan: has left #ruby: ()
[08:30:53] matthewd: First, add a puts to the top of the file, run it, and prove you see that output
[08:32:35] frozengeek: has joined #ruby
[08:33:36] marr: has joined #ruby
[08:33:38] rabajaj: has joined #ruby
[08:33:41] aihwh: matthewd: i did, it is not working and can't see the output
[08:33:48] aihwh: the error is also different
[08:34:26] matthewd: gist the code and the error
[08:34:28] rabajaj: has joined #ruby
[08:34:48] djbkd: has joined #ruby
[08:35:21] Siyfion: has joined #ruby
[08:35:23] vayan: has joined #ruby
[08:36:37] aihwh: matthewd: https://gist.github.com/anonymous/a9b01e8f3b07cf8ef08e311a763eda86 here is the code; here is the error: https://gist.github.com/anonymous/3fab2a9c71ef8dbb5e0b956fd85a3f9d
[08:37:47] matthewd: Okay, so the right file is being executed
[08:38:08] sepp2k: has joined #ruby
[08:38:14] matthewd: As the error says, there's a bug on line 74, so fix that
[08:38:32] matthewd: The comma in the URL is there because you're putting it there, in your command line
[08:38:46] aihwh: matthewd: i see..
[08:38:54] matthewd: @currency is "BAT,"
[08:39:10] aihwh: so it was a typing error
[08:39:45] xall_: has joined #ruby
[08:40:50] aihwh: matthewd: thank you so much! :)
[08:41:10] aihwh: i fixed the error on line 74, gave the correct parameters to command
[08:41:15] aihwh: and now everything seems to be working
[08:41:30] matthewd: Still doesn't explain why your previous 'blank?' error was occurring, when you don't call such a method :/
[08:42:00] aihwh: it was nothing, when searching on google/stackoverflow for my error
[08:42:08] frozengeek: has joined #ruby
[08:42:15] aihwh: i came across answers stating that getting datas from an array, could be done with present?
[08:42:31] aihwh: i put blank? there just as a test, the error was actually "first", not "blank" nor "present"
[08:42:47] aihwh: bittrex_bot.rb:147:in `get_market_summary': undefined method `first' for nil:NilClass (NoMethodError)
[08:42:51] aihwh: but i seems it got past that
[08:42:57] matthewd: Ah, so you wasted an hour and a half because you lied
[08:43:09] aihwh: indeed, i was decieved and not looking at the correct errors..
[08:43:18] aihwh: matthewd: ha :D
[08:47:15] workmad3: has joined #ruby
[08:47:35] PacificSalmon: aihwh: blank? comes from activesupport. it's not part of standard ruby. same for present?. so that's most likely why those methods never worked.
[08:48:52] aihwh: PacificSalmon: i see.. thank you very much :)
[08:48:59] aihwh: both of you, for showing interest and having patience with me
[08:49:25] PacificSalmon: for your script i think i would raise for cases where API fails, print an error and stack trace THEN exit(false) at the end. don't try to recover, since it's interactive anyway
[08:49:46] mim1k_: has joined #ruby
[08:50:48] lxsameer: has joined #ruby
[08:50:52] PacificSalmon: but not sure what works best for you. your script only looks good for happy paths.
[08:51:04] roshanavand: has joined #ruby
[08:51:29] ramfjord: has joined #ruby
[08:58:15] Beams: has joined #ruby
[08:58:29] kassav_: has joined #ruby
[09:03:14] benjen: has joined #ruby
[09:09:19] djbkd: has joined #ruby
[09:09:33] SteenJobs_: has joined #ruby
[09:10:04] djbkd: has joined #ruby
[09:10:54] djbkd: has joined #ruby
[09:11:43] djbkd: has joined #ruby
[09:18:14] bronson: has joined #ruby
[09:18:32] cadillac_: has joined #ruby
[09:21:23] Qchmqs__: has joined #ruby
[09:38:17] jaruga_________: has joined #ruby
[09:40:44] frozengeek: has joined #ruby
[09:41:55] ayonkhan: has joined #ruby
[09:42:05] jinie: has joined #ruby
[09:42:06] frozengeek: has joined #ruby
[09:47:27] anas: has joined #ruby
[09:48:03] ferr: has joined #ruby
[09:52:10] dc_99: has joined #ruby
[09:55:38] paranoicsan: has joined #ruby
[10:03:21] romankapitonov: has joined #ruby
[10:12:22] pandaant: has joined #ruby
[10:13:39] djbkd: has joined #ruby
[10:14:52] darix: PacificSalmon: be optimistic. things will never fail!
[10:17:36] Paraxial: has joined #ruby
[10:23:18] ShekharReddy: has joined #ruby
[10:24:05] Mortomes|Work: has joined #ruby
[10:25:19] agent_white: has joined #ruby
[10:25:43] Paraxial: has joined #ruby
[10:25:46] DrCode: has joined #ruby
[10:26:15] ShalokShalom_: has joined #ruby
[10:31:08] ur5us: has joined #ruby
[10:31:34] neo95: has joined #ruby
[10:31:41] akkad: has joined #ruby
[10:32:53] ramfjord: has joined #ruby
[10:32:56] ramfjord_: has joined #ruby
[10:41:38] mark_on_the_moon: has joined #ruby
[10:42:54] hutch34: has joined #ruby
[10:45:06] charliesome: has joined #ruby
[10:47:26] frozengeek: has joined #ruby
[10:49:17] Zaab1t: has joined #ruby
[10:52:26] Zaab1t: Hi there. How's ruby doing on the asyncronous (hype)front?
[10:53:43] ramfjord: has joined #ruby
[10:53:44] ramfjord_: has joined #ruby
[10:54:28] numbdewd: has joined #ruby
[10:55:54] uZiel: has joined #ruby
[10:56:32] matthewd: Zaab1t: About twelve, I think
[10:58:22] Defenestrate: has joined #ruby
[11:03:35] apparition47: has joined #ruby
[11:06:49] mtkd: has joined #ruby
[11:13:58] frozengeek: has joined #ruby
[11:14:29] ramfjord: has joined #ruby
[11:14:30] ramfjord_: has joined #ruby
[11:19:20] bronson: has joined #ruby
[11:19:58] xco: has joined #ruby
[11:34:41] Ishido: has joined #ruby
[11:35:18] ramfjord: has joined #ruby
[11:35:19] ramfjord_: has joined #ruby
[11:35:33] Stickwalker: has joined #ruby
[11:38:41] akkad: has joined #ruby
[11:46:22] frozengeek: has joined #ruby
[11:52:05] Pumukel: has joined #ruby
[11:52:34] houhoulis: has joined #ruby
[11:55:19] neo95: has joined #ruby
[11:56:08] ramfjord: has joined #ruby
[11:56:09] ramfjord_: has joined #ruby
[12:03:50] Mon_Ouie: has joined #ruby
[12:09:25] cats: has joined #ruby
[12:10:24] Miron: has joined #ruby
[12:10:34] TomyWork: has joined #ruby
[12:16:14] WebDawg: has joined #ruby
[12:16:57] ramfjord: has joined #ruby
[12:16:58] ramfjord_: has joined #ruby
[12:18:54] mikecmpb_: has joined #ruby
[12:24:38] quobo: has joined #ruby
[12:28:20] ayonkhan: has joined #ruby
[12:28:49] t-recx: has joined #ruby
[12:32:09] neo95: has joined #ruby
[12:36:42] gheegh: has joined #ruby
[12:37:39] ramfjord: has joined #ruby
[12:37:40] ramfjord_: has joined #ruby
[12:38:52] karmayogi23: has joined #ruby
[12:41:34] aihwh: has joined #ruby
[12:42:04] charliesome: has joined #ruby
[12:45:37] alex``: has joined #ruby
[12:47:41] DTZUZO: has joined #ruby
[12:51:00] mbtez_: has joined #ruby
[12:51:42] mbtez_: has left #ruby: ()
[12:56:58] kreantos_: has joined #ruby
[12:58:32] ramfjord: has joined #ruby
[12:58:33] ramfjord_: has joined #ruby
[12:58:42] KeyJoo: has joined #ruby
[13:00:17] Pumukel: has joined #ruby
[13:03:07] kobain: has joined #ruby
[13:04:00] tomphp: has joined #ruby
[13:06:16] Jameser: has joined #ruby
[13:06:59] neo95: has joined #ruby
[13:07:39] nobody: has joined #ruby
[13:09:10] crst: has joined #ruby
[13:10:52] __Yiota: has joined #ruby
[13:12:31] tomphp: has joined #ruby
[13:12:32] Sylario: has joined #ruby
[13:15:52] neo95: has joined #ruby
[13:19:18] ramfjord: has joined #ruby
[13:19:19] ramfjord_: has joined #ruby
[13:19:22] WeiJunLi: has joined #ruby
[13:20:08] bronson: has joined #ruby
[13:22:14] ornerymoose: has joined #ruby
[13:28:28] someuser: has joined #ruby
[13:30:32] gheegh: has joined #ruby
[13:33:36] ldnunes: has joined #ruby
[13:34:25] gheegh: has joined #ruby
[13:35:13] Tempesta: has joined #ruby
[13:38:16] gheegh: has joined #ruby
[13:40:04] ramfjord: has joined #ruby
[13:40:05] ramfjord_: has joined #ruby
[13:41:14] bruno-: has joined #ruby
[13:41:53] gheegh: has joined #ruby
[13:44:31] joast: has joined #ruby
[13:45:05] neo95: has joined #ruby
[13:45:41] gheegh: has joined #ruby
[13:49:46] gheegh: has joined #ruby
[13:50:03] bruno-: has joined #ruby
[13:50:57] frozengeek: has joined #ruby
[13:51:24] dn`: has joined #ruby
[13:53:28] gheegh: has joined #ruby
[13:57:11] gheegh: has joined #ruby
[13:57:19] bruno-: has joined #ruby
[13:58:51] tomphp: has joined #ruby
[14:00:53] ramfjord: has joined #ruby
[14:00:54] ramfjord_: has joined #ruby
[14:01:01] gheegh: has joined #ruby
[14:02:23] bruno-: has joined #ruby
[14:03:27] gheegh: has joined #ruby
[14:03:44] xco: has joined #ruby
[14:03:53] riton: has joined #ruby
[14:04:46] tsglove: has joined #ruby
[14:04:55] riton: hi guys, I need to use Etc.getpwnam() function in Ruby 2.x. I'm wondering. Is this function thread safe ?
[14:08:18] kn-928: has joined #ruby
[14:08:31] dminuoso: riton: Generally ruby does not have thread safety. A few specialties are implicitly thread safe due to how the GVL is used though.
[14:09:24] dminuoso: riton: What race condition are you worried about?
[14:09:38] futilegames: has joined #ruby
[14:09:55] futilegames: has left #ruby: ()
[14:11:38] riton: the one related to the use of static buffers in the gLibc
[14:12:19] matthewd: At a glance it calls getpwnam(3): https://github.com/ruby/ruby/blob/515ac69f95aedfb7b2dac2e031dd7d1d600f11a8/ext/etc/etc.c#L220
[14:12:49] SpComb: but that function will be locked by the GVL
[14:13:09] riton: SpComb: where do you see that ?
[14:13:24] SpComb: https://www.jstorimer.com/blogs/workingwithcode/8100871-nobody-understands-the-gil-part-2-implementation
[14:13:59] matthewd: SpComb: Only one instance of ruby-land `Etc.getpwnam` could be calling it at one time, but another unlocked thread could call the same libc function
[14:14:02] SpComb: it's an MRI C function. Between the call to getpwnam and setup_passwd (which I assume copies the strings), it's implicitly locked against any other ruby threads
[14:14:18] SpComb: yeah, not safe against other non-ruby threads, if that's a concern
[14:15:13] akkad: has joined #ruby
[14:17:03] riton: SpComb: my concern is only about ruby threads
[14:17:34] riton: SpComb: I'm trying to understand what you've just said by reading the link you pointed out
[14:17:43] matthewd: Oh, then yeah, you can trust it to the GVL
[14:17:50] bruno-: has joined #ruby
[14:18:25] oleo: has joined #ruby
[14:19:04] nadir: has joined #ruby
[14:19:07] riton: SpComb: a "quite important" detail is that I'm using JRuby (in PuppetServer)
[14:19:21] SpComb: riton: then you can ignore all of those links
[14:20:01] dminuoso: riton: JRuby has such lock. So you need to implement mutual exclusion yourself.
[14:20:05] dminuoso: *no such lock
[14:20:15] riton: SpComb: dminuoso: thanks !
[14:20:27] matthewd: Then you'd need to check the jruby source, but it seems safe to assume that whatever underlying Java API they're using to implement it is already threadsafe
[14:21:15] SpComb: yeah, I would be surprised if the jruby implementation of that didn't use getpwnam_r
[14:21:39] dminuoso: SpComb: Checkout #jruby - its a good place to ask jruby specific questions
[14:21:41] ramfjord: has joined #ruby
[14:21:42] ramfjord_: has joined #ruby
[14:22:34] riton: https://github.com/jruby/jruby/blob/f7746d0be94f5d9f7cd27af610f1bc5dd2622794/core/src/main/java/org/jruby/ext/etc/RubyEtc.java#L146
[14:22:50] bruno-: has joined #ruby
[14:23:04] riton: the method is synchronized so (if my Java memory is still here) it's thread safe
[14:23:05] dminuoso: synchronized
[14:23:26] dminuoso: riton: So you gain the same guarantee as MRI it would seem
[14:24:46] riton: dminuoso: SpComb : matthewd : thanks for your time
[14:25:52] riton: has left #ruby: ("WeeChat 1.9")
[14:27:50] bruno-: has joined #ruby
[14:28:48] SpComb: https://github.com/jnr/jnr-posix/blob/cc072ac7ce89410e881bbd140c88a58334024cba/src/main/java/jnr/posix/BaseNativePOSIX.java#L192 AFAICT it does actually call getpwnam though, not _r
[14:28:55] SpComb: so I'm surprised
[14:32:54] bruno-: has joined #ruby
[14:37:50] bruno-: has joined #ruby
[14:39:56] Guest40: has joined #ruby
[14:41:49] mtkd: has joined #ruby
[14:42:52] bruno-: has joined #ruby
[14:43:04] roshanavand: has joined #ruby
[14:44:06] twillkens: has joined #ruby
[14:45:21] mim1k: has joined #ruby
[14:46:33] ayonkhan: has joined #ruby
[14:47:54] bruno-: has joined #ruby
[14:50:11] charliesome: has joined #ruby
[14:52:52] bruno-: has joined #ruby
[14:53:01] ianfleeton: has joined #ruby
[14:56:27] ianfleeton: has joined #ruby
[14:57:14] Jameser: has joined #ruby
[14:57:50] bruno-: has joined #ruby
[15:00:16] skweek: has joined #ruby
[15:01:27] ramfjord: has joined #ruby
[15:01:28] ramfjord_: has joined #ruby
[15:02:50] bruno-: has joined #ruby
[15:05:11] govg: has joined #ruby
[15:07:53] bruno-: has joined #ruby
[15:11:57] logicscience: has joined #ruby
[15:13:27] bruno-: has joined #ruby
[15:16:02] govg: has joined #ruby
[15:17:24] dionysus69: has joined #ruby
[15:18:25] bruno-: has joined #ruby
[15:19:45] nobody: has joined #ruby
[15:21:53] bronson: has joined #ruby
[15:22:13] ramfjord: has joined #ruby
[15:22:14] ramfjord_: has joined #ruby
[15:23:24] bruno-: has joined #ruby
[15:24:42] griffindy: has joined #ruby
[15:26:29] m27frogy: has joined #ruby
[15:31:45] nertzy: has joined #ruby
[15:36:56] goyox86_: has joined #ruby
[15:36:59] zacts: has joined #ruby
[15:40:08] m27frogy: has joined #ruby
[15:43:01] ramfjord: has joined #ruby
[15:43:02] ramfjord_: has joined #ruby
[15:43:16] hutch34: has joined #ruby
[15:43:47] aufi: has joined #ruby
[15:46:35] PacificSalmon: "Generally ruby does not have thread safety." .. is this really true? imo all core data structures and even stdlib ones (Set etc) should make every effort to be thread safe out of the box, so the programmer doesn't have to worry about it.
[15:48:12] matthewd: Depends how you define a few of those words, but basically yes
[15:48:31] PacificSalmon: so Array and so on are all non-threadsafe?
[15:48:54] matthewd: Again, it depends, but yes
[15:49:14] PacificSalmon: do you have an example where it depends, or can elaborate more please
[15:49:59] matthewd: Hash (and Array, I believe) is not threadsafe by spec, but is safe in practice in MRI, because of the GVL
[15:50:43] PacificSalmon: so, then, MRI has thread safety via the GVL for core ruby data structures. is that true?
[15:51:30] matthewd: So concurrent reads/writes can't actually crash MRI, but the same operations on a truly multithreaded runtime like jruby are allowed to misbehave (while not making those implementations non-conformant)
[15:52:14] PacificSalmon: by can't crash you mean can't race condition?
[15:53:00] matthewd: Yes, though I was more emphasising the fact that other runtimes can crash-crash
[15:53:12] matthewd: As in segfault, AIUI
[15:53:42] PacificSalmon: okay. well, good to know. then only jruby/rbx have a need to care about thread safety around core structures. and maybe they take their own steps to solve that, or are you on your own?
[15:54:18] snickers: has joined #ruby
[15:54:55] PacificSalmon: i like the model where core data structures are safe by the default, so i guess i prefer MRI's model in this specific example.
[15:54:59] matthewd: It's my understanding that Word Of God says they're allowed to crash, and MRI's apparent thread-safety is a side effect / implementation detail, which could go away
[15:55:31] dminuoso: PacificSalmon: No, MRIs GVL is not a strength. Its entirely a weakness.
[15:55:51] dminuoso: PacificSalmon: Ruby shouldn't need a lock to protect its internals, JRuby doesn't for example.
[15:56:29] PacificSalmon: iirc it's mostly for C extension authors they do not want to change this. as well as not having to deal with complexities of threaded programming.
[15:56:37] dminuoso: PacificSalmon: This lock comes with a steep price: At no moment may two ruby threads of the same process execute ruby-land things.
[15:56:55] tomphp: has joined #ruby
[15:56:57] dminuoso: Which means that most benefits of threads are limited to blocking I/O.
[15:57:17] PacificSalmon: they're still concurrent at least.
[15:57:22] dminuoso: But ruby-land methods dont execute atomically, which means you still have no benefits.
[15:57:35] sepp2k: has joined #ruby
[15:57:58] matthewd: Even C-land methods don't execute atomically in practice
[15:59:05] SeepingN: has joined #ruby
[15:59:48] PacificSalmon: not sure. i personally don't have much of a problem with rubys threaded implementation but only ever used them in Fiber-like way.
[15:59:50] orbyt_: has joined #ruby
[16:00:02] tomphp: has joined #ruby
[16:00:16] nowhere_man: has joined #ruby
[16:00:42] conta3: has joined #ruby
[16:00:58] roshanavand: has joined #ruby
[16:01:22] PacificSalmon: there's also Kernel.fork, and CoW GC. i know it's not threads, but still something if on Unix-y OS.
[16:01:37] PacificSalmon: which jruby cannot do :)
[16:03:16] milardovich: has joined #ruby
[16:03:49] ramfjord: has joined #ruby
[16:03:50] ramfjord_: has joined #ruby
[16:03:55] spheric: has joined #ruby
[16:04:47] therealGent: has joined #ruby
[16:06:30] PacificSalmon: thanks for the info. i will probably mutex all global data structures i have, for jruby&rbx.
[16:06:57] tomphp: has joined #ruby
[16:07:48] BTRE: has joined #ruby
[16:07:51] FrostCandy: has joined #ruby
[16:12:55] matthewd: PacificSalmon: Better to use Concurrent::{Array,Hash,Map} -- they have the locks they need, but only where needed
[16:13:09] bruno-: has joined #ruby
[16:13:41] PacificSalmon: it's not an option in my case. too much of a dependency. i hope some of those changes go back into official ruby instead.
[16:13:52] Mon_Ouie: has joined #ruby
[16:14:28] PacificSalmon: but i'll see if a copy&paste just what i need. cheers
[16:14:45] matthewd: You're going to have problems when they finish moving more of stdlib out into gems then, I guess
[16:15:30] PacificSalmon: i don't think so... the stdlib will still be the stdlib, but distribution method will be different.
[16:15:46] matthewd: (as concurrent-ruby is small, I take it "too much" is actually "a dependency at all")
[16:16:20] PacificSalmon: ok, in another way: i don't want a third party library to solve this problem for me. i would make efforts to use thread-local state, or a mutex instead.
[16:17:06] PacificSalmon: or some part of Ruby. it's nothing against concurrent-ruby. i just don't want to depend on it in the project where this stuff matters.
[16:19:12] ShalokShalom: has joined #ruby
[16:20:48] PacificSalmon: https://github.com/ruby-concurrency/concurrent-ruby/pull/666/files
[16:21:29] cadillac_: has joined #ruby
[16:22:08] mim1k: has joined #ruby
[16:23:41] WeiJunLi: has joined #ruby
[16:24:36] ramfjord: has joined #ruby
[16:24:37] ramfjord_: has joined #ruby
[16:25:43] ozcanesen: has joined #ruby
[16:27:42] gheegh: has joined #ruby
[16:30:15] segy: has joined #ruby
[16:31:55] darix: PacificSalmon: instead you reimplemenet all the things ;)
[16:35:00] darix: https://twitter.com/rmayoff/status/903671664721973248
[16:36:10] PacificSalmon: but i'm only interested in `Set`. on JRuby it looks very simple ('include JRuby::Synchronized'). rbx i dunno what's going on there. could be a lot of stuff to copy over.
[16:36:19] uZiel: has joined #ruby
[16:37:21] gothicsouth: has joined #ruby
[16:38:00] PacificSalmon: nothing to do with NIH. the context is people already complain about too many dependencies of proj i want to add it to. i don't want to make it worse. and in my case, it looks overkill to depend on concurrent-jruby in its entireity.
[16:38:18] PacificSalmon: concurrent-ruby*
[16:38:58] kreantos: has joined #ruby
[16:38:59] darix: PacificSalmon: i have the opposite problem here... people here reimplement all the stuff in a barely enough fashion ;)
[16:39:51] kreantos_: has joined #ruby
[16:40:25] matthewd: I'd expect the average many-dep-tree project to already have concurrent-ruby (or its predecessor, threadsafe) somewhere in there
[16:40:39] PacificSalmon: im not an app. i'm a library
[16:40:49] PacificSalmon: and people say, too many deps. can you cut them. all the time
[16:41:25] matthewd: Yeah, I'm not unfamiliar with such complaints
[16:44:33] PacificSalmon: yeah. quite strange. it's common in npm land to depend on a gazillion things, and for a 'package' to just be a function.
[16:44:55] segy: has joined #ruby
[16:45:27] ramfjord: has joined #ruby
[16:45:28] ramfjord_: has joined #ruby
[16:45:48] workmad3: PacificSalmon: and just look at the fun the npm community had with that with lpad :)
[16:45:54] darix: PacificSalmon: you mean like gitlab nowadays ...87mb checkedout from their git ... 188MB JS libraries pulled via yarn. (and that is only production stuff no dev stuff)
[16:48:12] frozengeek: has joined #ruby
[16:49:25] bruno-: has joined #ruby
[16:51:00] SeepingN: has joined #ruby
[16:51:42] milardovich: has joined #ruby
[16:56:01] cconstantine: has joined #ruby
[16:56:27] TheLemonMan: has joined #ruby
[16:58:02] ayonkhan_: has joined #ruby
[16:58:39] TheLemonMan: hello, I'm trying to slurp the output of the 'ag' tool from a ruby script but for somehow the stdout is always empty...here's my script https://gist.github.com/LemonBoy/ac09aece2714f01a3ee61f11938c16c7
[17:00:06] Rodya_: has joined #ruby
[17:00:17] TheLemonMan: strace shows no write() at all which is pretty weird
[17:00:38] yokel: has joined #ruby
[17:04:57] tomphp: has joined #ruby
[17:06:12] ramfjord: has joined #ruby
[17:06:13] ramfjord_: has joined #ruby
[17:06:37] phinxy: has joined #ruby
[17:07:08] PacificSalmon: is it waiting for input maybe?
[17:09:43] _sfiguser: has joined #ruby
[17:10:07] xco: has left #ruby: ()
[17:11:02] quobo: has joined #ruby
[17:12:37] konsolebox: has joined #ruby
[17:13:44] belmoussaoui: has joined #ruby
[17:16:02] mim1k: has joined #ruby
[17:17:50] anisha: has joined #ruby
[17:19:05] conta1: has joined #ruby
[17:22:55] bronson: has joined #ruby
[17:23:18] TheLemonMan: meh, 'ag' was being a dick since stdin was connected to a pipe
[17:23:27] TheLemonMan: has left #ruby: ()
[17:25:47] joast: has joined #ruby
[17:27:03] ramfjord_: has joined #ruby
[17:27:03] ramfjord: has joined #ruby
[17:28:02] gothicsouth: has joined #ruby
[17:28:03] saltsa: has joined #ruby
[17:29:31] zachk: has joined #ruby
[17:33:52] gusrub: has joined #ruby
[17:35:13] kn-928: has joined #ruby
[17:35:48] belmoussaoui: has joined #ruby
[17:36:31] kreantos: has joined #ruby
[17:38:36] imode: has joined #ruby
[17:39:44] ayonkhan: has joined #ruby
[17:40:33] _sfiguser: has joined #ruby
[17:45:38] AndChat182964: has joined #ruby
[17:45:51] AndChat182964: Anyone looking for assistant?
[17:46:04] AndChat182964: I want to learn code by work
[17:47:48] ramfjord: has joined #ruby
[17:47:49] ramfjord_: has joined #ruby
[17:49:24] joast: has joined #ruby
[17:49:42] __Yiota: has joined #ruby
[17:54:09] PacificSalmon: AndChat182964: i would recommend to try contributing to an open source project instead, but for a more 1-1 scenario maybe search twitter for 'ruby mentors', or 'remote pair programming'.
[17:57:47] t-recx: has joined #ruby
[17:57:51] Azure: has joined #ruby
[17:58:04] TomyLobo: has joined #ruby
[17:58:04] ledestin: has joined #ruby
[17:59:02] goyox86_: has joined #ruby
[17:59:56] milardovich: has joined #ruby
[18:01:48] konsolebox: has joined #ruby
[18:02:53] twillkens: has joined #ruby
[18:07:28] funkytwig: has joined #ruby
[18:08:24] skweek: has joined #ruby
[18:08:35] ramfjord: has joined #ruby
[18:08:36] ramfjord_: has joined #ruby
[18:10:47] mkali: has joined #ruby
[18:12:15] nicesignal: has joined #ruby
[18:12:40] konsolebox: has joined #ruby
[18:13:04] enterprisey: has joined #ruby
[18:14:54] maryo: has joined #ruby
[18:19:02] lxsameer: has joined #ruby
[18:20:37] ianfleeton: has joined #ruby
[18:25:00] zautomata: has joined #ruby
[18:26:08] FastJack: has joined #ruby
[18:26:28] armyriad: has joined #ruby
[18:26:42] Ishido: has joined #ruby
[18:27:44] SeepingN: has joined #ruby
[18:28:22] JeanCarloMachado: has joined #ruby
[18:28:46] goyox86_: has joined #ruby
[18:29:18] AnoHito: has joined #ruby
[18:29:23] ramfjord: has joined #ruby
[18:29:24] ramfjord_: has joined #ruby
[18:29:40] skweek: has joined #ruby
[18:29:57] cdg: has joined #ruby
[18:30:24] sonOfRa_: has joined #ruby
[18:30:28] wsmoak_: has joined #ruby
[18:30:37] [diecast]__: has joined #ruby
[18:30:37] jimeh_: has joined #ruby
[18:30:39] olivierjanss_: has joined #ruby
[18:30:49] solidsnack_: has joined #ruby
[18:30:53] andersh_: has joined #ruby
[18:30:53] Tony-St4rk_: has joined #ruby
[18:30:55] pwillard_: has joined #ruby
[18:31:02] jxf_: has joined #ruby
[18:31:04] caw__: has joined #ruby
[18:31:36] SteenJobs_: has joined #ruby
[18:31:44] hlmjr: has joined #ruby
[18:31:53] kmhn: has joined #ruby
[18:32:04] Rush: has joined #ruby
[18:32:06] rikai_: has joined #ruby
[18:32:39] TvL: has joined #ruby
[18:32:49] ur5us: has joined #ruby
[18:32:51] ovaltine1: has joined #ruby
[18:32:52] claws: has joined #ruby
[18:33:06] s00pcan_: has joined #ruby
[18:33:26] genpaku_: has joined #ruby
[18:33:33] pavelz_: has joined #ruby
[18:35:50] jsrn_: has joined #ruby
[18:35:50] universal: has joined #ruby
[18:35:59] rgr: has joined #ruby
[18:36:05] rcs_: has joined #ruby
[18:36:12] brucebag_: has joined #ruby
[18:36:27] soahccc^: has joined #ruby
[18:36:31] Kilobyte22: has joined #ruby
[18:36:32] web_nanners: has joined #ruby
[18:36:34] Zarthus_: has joined #ruby
[18:36:37] Bilge-: has joined #ruby
[18:36:38] ikopico_: has joined #ruby
[18:37:21] saneax___: has joined #ruby
[18:37:32] sonne_: has joined #ruby
[18:38:25] brucebag: has joined #ruby
[18:38:25] reu: has joined #ruby
[18:38:25] JeanCarl1Machado: has joined #ruby
[18:38:25] WebDawg: has joined #ruby
[18:38:25] qsx: has joined #ruby
[18:38:25] mikecmpbll: has joined #ruby
[18:38:40] 94KABDDRC: has joined #ruby
[18:38:45] kn-928: has joined #ruby
[18:39:37] ayonkhan_: has joined #ruby
[18:40:24] Nahra`: has joined #ruby
[18:40:24] justinwe`: has joined #ruby
[18:40:27] dionysus69: has joined #ruby
[18:41:27] armando-: has joined #ruby
[18:42:25] okdas: has joined #ruby
[18:42:25] okdas: has joined #ruby
[18:42:31] yxhuvud: has joined #ruby
[18:42:33] jnollette: has joined #ruby
[18:42:34] Paraxial: has joined #ruby
[18:42:39] knight_: has joined #ruby
[18:42:42] justinmcp: has joined #ruby
[18:42:52] ahrs: has joined #ruby
[18:42:53] marr: has joined #ruby
[18:42:54] milardovich: has joined #ruby
[18:44:19] kies: has joined #ruby
[18:44:21] FiendKing04: has joined #ruby
[18:44:22] typeVoid: has joined #ruby
[18:45:34] sagax: has joined #ruby
[18:45:47] spider-mario: has joined #ruby
[18:46:04] pavelz: has joined #ruby
[18:46:53] bokayio: has joined #ruby
[18:46:59] claudiuinberlin: has joined #ruby
[18:47:10] velu_aon[m]: has joined #ruby
[18:47:11] daemonwrangler: has joined #ruby
[18:47:13] halt: has joined #ruby
[18:47:20] Lyubo1: has joined #ruby
[18:47:22] diegok: has joined #ruby
[18:47:35] hfp_work: has joined #ruby
[18:48:12] JeanCarl1Machado: has joined #ruby
[18:48:57] Giphy[m]: has joined #ruby
[18:49:03] WeiJunLi: has joined #ruby
[18:49:20] JeanCarl1Machado: has joined #ruby
[18:49:56] armyriad: has joined #ruby
[18:50:10] ramfjord: has joined #ruby
[18:50:11] ramfjord_: has joined #ruby
[18:50:37] maryo_: has joined #ruby
[18:52:44] gothicsouth: has joined #ruby
[18:56:23] JeanCarl1Machado: has joined #ruby
[18:58:15] twillkens: has joined #ruby
[18:59:17] JeanCarloMachado: has joined #ruby
[18:59:18] S007: has joined #ruby
[18:59:45] JeanCarloMachado: has joined #ruby
[19:01:17] raynold: has joined #ruby
[19:04:53] gothicsouth: has joined #ruby
[19:06:50] JeanCarloMachado: has joined #ruby
[19:07:40] JeanCarloMachado: has joined #ruby
[19:08:16] JeanCarloMachado: has joined #ruby
[19:08:41] modin: has joined #ruby
[19:16:40] griffindy: has joined #ruby
[19:17:18] Mon_Ouie: has joined #ruby
[19:22:27] nobody: has joined #ruby
[19:23:35] bronson: has joined #ruby
[19:25:30] Cohedrin_: has joined #ruby
[19:27:27] Dimik: has joined #ruby
[19:29:54] claudiuinberlin: has joined #ruby
[19:30:15] ged: has joined #ruby
[19:33:19] ayonkhan: has joined #ruby
[19:35:00] joelroa: has joined #ruby
[19:37:14] quobo: has joined #ruby
[19:37:48] nobody: has joined #ruby
[19:39:44] ramfjord: has joined #ruby
[19:39:45] ramfjord_: has joined #ruby
[19:41:17] gusrub: has joined #ruby
[19:41:34] claudiuinberlin: has joined #ruby
[19:46:34] milardovich: has joined #ruby
[19:47:32] cdg: has joined #ruby
[19:49:55] ornerymoose: has joined #ruby
[19:58:44] dionysus70: has joined #ruby
[19:59:45] snapcase: has joined #ruby
[19:59:57] klaas: has joined #ruby
[20:04:25] FastJack_: has joined #ruby
[20:05:10] joelroa: has joined #ruby
[20:08:27] raul782: has joined #ruby
[20:13:06] ur5us: has joined #ruby
[20:14:27] runescape07rsps: has joined #ruby
[20:15:05] neo95: has joined #ruby
[20:15:50] johnny56: has joined #ruby
[20:18:42] tAn: has joined #ruby
[20:22:10] WeiJunLi: has joined #ruby
[20:24:06] ayonkhan: has joined #ruby
[20:25:16] RedNifre: Good evening!
[20:25:29] al2o3-cr: has joined #ruby
[20:26:01] RedNifre: I partially read the whole "Learning Ruby" book, ruby sure is nice.
[20:26:14] RedNifre: However, I miss some functional programming constructs like currying and partial function application
[20:26:36] RedNifre: I noticed that I can add those with the nice metaprogramming features, but are there any good FP libraries that you can recommend?
[20:27:34] podman: has joined #ruby
[20:27:41] TastyTrout: https://github.com/banister/funkify and there's Proc/lambda#curry.
[20:27:49] aphelion: has joined #ruby
[20:28:34] BSaboia: has joined #ruby
[20:29:03] RedNifre: Ah, looks perfect.
[20:31:11] TastyTrout: yup. ruby-esque but quite old. not sure if it still works.
[20:32:07] raul782: has joined #ruby
[20:33:20] millerti: has joined #ruby
[20:35:37] charliesome: has joined #ruby
[20:37:42] ayonkhan_: has joined #ruby
[20:37:52] raul782: has joined #ruby
[20:39:39] ldnunes: has joined #ruby
[20:40:09] kn-928: has joined #ruby
[20:44:23] AndChat182964: has left #ruby: ("Leaving")
[20:46:06] gheegh: has joined #ruby
[20:47:19] ayonkhan: has joined #ruby
[20:48:04] hutch34: has joined #ruby
[20:49:07] aphelion: has joined #ruby
[20:54:25] RedNifre: Regarding blocks and procs, is the & in `map &someProc` really needed? Why can't blocks and procs be used interchangeable?
[20:55:34] tomphp: has joined #ruby
[20:55:45] bruno-: has joined #ruby
[20:56:27] Azure|dc: has joined #ruby
[20:56:50] sp4rrow: has joined #ruby
[20:57:43] tAn: has joined #ruby
[20:57:52] gothicsouth: has joined #ruby
[20:57:58] Rodya_: has joined #ruby
[21:05:43] TastyTrout: it's a good question. blocks exist as syntax, until there's a Proc object that can represent the syntax as an object. the leading '&' is a bit context dependent. in a method definiton, eg: def foo(&bar); end the block will be captured in a Proc referenced by 'bar'. in your example, it's taking what may already be a Proc, and passing it as though it's a block. i'm not super well versed in this stuff, but that's my
[21:05:44] TastyTrout: vague recollection of it.
[21:07:19] Ishido: has joined #ruby
[21:08:03] TastyTrout: i think it's also more performant to not create a Proc, since it requires capturing a binding and creating an object.
[21:11:41] JeanCarloMachado: has joined #ruby
[21:12:25] Puffball: has joined #ruby
[21:16:34] WeiJunLi: has joined #ruby
[21:17:18] orbyt_: has joined #ruby
[21:17:25] jinie: has joined #ruby
[21:24:57] bronson: has joined #ruby
[21:25:32] selim: has joined #ruby
[21:27:03] ornerymoose: has joined #ruby
[21:30:57] mim1k: has joined #ruby
[21:38:08] neo95: has joined #ruby
[21:40:02] hutch34: has joined #ruby
[21:47:18] mtkd: has joined #ruby
[21:49:17] hutch34: has joined #ruby
[21:54:40] abcd1234: has joined #ruby
[21:55:27] ResidentBiscuit: has joined #ruby
[21:58:31] Rodya_: has joined #ruby
[21:59:56] ayonkhan_: has joined #ruby
[22:01:39] apeiros_: has joined #ruby
[22:06:59] ramfjord: has joined #ruby
[22:07:01] ramfjord_: has joined #ruby
[22:08:30] dtzuzu: has joined #ruby
[22:09:30] cdg: has joined #ruby
[22:11:28] gusrub_: has joined #ruby
[22:16:31] neo95: has joined #ruby
[22:16:55] cdg: has joined #ruby
[22:18:06] __Yiota: has joined #ruby
[22:22:44] AxelAlex: has joined #ruby
[22:33:37] __Yiota: has joined #ruby
[22:37:47] hutch34: has joined #ruby
[22:42:03] millerti: has joined #ruby
[22:42:14] jeremroberts: has joined #ruby
[22:43:32] ncthom91: has joined #ruby
[22:51:53] pharma_joe: has joined #ruby
[22:58:34] eckhardt: has joined #ruby
[22:59:40] Rodya_: has joined #ruby
[23:05:45] roshanavand: has joined #ruby
[23:08:20] roshanavand: has joined #ruby
[23:08:51] alveric1: has joined #ruby
[23:09:33] imode: has joined #ruby
[23:11:52] runescape07rsps: has joined #ruby
[23:14:29] gizmore: has joined #ruby
[23:16:00] goyox86_: has joined #ruby
[23:16:59] pharma_joe: has joined #ruby
[23:23:04] johnny56: has joined #ruby
[23:23:54] xdc: has joined #ruby
[23:24:33] xdcc: has joined #ruby
[23:25:21] mikecmpbll: has joined #ruby
[23:25:51] bronson: has joined #ruby
[23:28:28] workmad3: has joined #ruby
[23:29:15] skweek: has joined #ruby
[23:31:19] mim1k: has joined #ruby
[23:36:38] arescorpio: has joined #ruby
[23:38:05] JeanCarloMachado: has joined #ruby
[23:39:45] kreantos: has joined #ruby
[23:42:52] runescape07rsps: has joined #ruby
[23:46:20] enterprisey: has joined #ruby
[23:51:37] pharma_joe: has joined #ruby