« Back to channel list

#ruby - 10 January 2019

« Back 1 day Forward 1 day »
[00:00:54] chouhoulis: has joined #ruby
[00:06:11] chouhoulis: has joined #ruby
[00:11:17] mikecmpbll: might just be because it's late and i'm tired but how can this line result in TypeError: no implicit conversion from nil to integer https://github.com/clbustos/minimization/blob/master/lib/multidim/nelder_mead.rb#L95
[00:11:43] chouhoulis: has joined #ruby
[00:11:52] baweaver: mikecmpbll: Can you shoot us the full error?
[00:12:13] baweaver: also super rare to see nested methods like that
[00:12:33] mikecmpbll: https://gist.github.com/mikecmpbll/ccf41e7f092703519f7edfa7203a2645
[00:12:48] baweaver: L96 may do bad things too, but probably not the point
[00:12:50] mikecmpbll: yeah it is indeed odd. they're funny folks those maths rubyists.
[00:12:55] cthulchu: I'm now switching to a few different projects none of which is Ruby. One is JS and one is Py. I never realized how much I would miss the black magic of ===
[00:13:00] cthulchu: hell it was insanely comfy
[00:13:28] cthulchu: inline regex is very comfy too
[00:13:49] baweaver: Hrm. I'd probably just drop a binding.pry in there and see why it's screwy.
[00:14:01] cthulchu: it would be awesome if Ruby had Python's white space syntax.
[00:14:32] hutch: has joined #ruby
[00:14:42] mikecmpbll: oh crap, i'm monkey patching the class. that'll probably mess with the line numbering or no?
[00:15:43] mikecmpbll: going to be extremely difficult to reproduce the error too, unfortunately. happens deep in a long running task with randomised input data :D
[00:16:05] baweaver: you could also put a rescue in there to try and catch it and reraise
[00:17:33] chouhoulis: has joined #ruby
[00:18:41] chouhoulis: has joined #ruby
[00:21:56] grvgr_: has joined #ruby
[00:23:58] chouhoulis: has joined #ruby
[00:25:10] chouhoulis: has joined #ruby
[00:27:53] phaul: that code has a lot of things that don't make sense ruby wise. Im not talking algorithm wise, but just pure language wise
[00:28:23] con3: has joined #ruby
[00:29:18] con3: hey everyone, I'm trying to run basic programs in ruby. using puts with hello world works great, but trying to get a method with return value going always bombs out
[00:29:40] con3: I'm following appacademy - open rn and this example does not work at all
[00:29:46] phaul: well, 9 year old code according to the license, stay strong mikecmpbll :)
[00:30:04] mikecmpbll: nothing _technically_ wrong with a method defined in a method :p
[00:30:20] Azure: has joined #ruby
[00:30:29] chouhoulis: has joined #ruby
[00:30:38] con3: https://dpaste.de/e7Zt
[00:30:57] phaul: no, I did not even meant that. just skimming the rest
[00:31:12] con3: this returns
[00:31:12] phaul: ah english...
[00:31:22] baweaver: con3: What's not working with it?
[00:32:01] con3: baweaver: it returns this : https://dpaste.de/CXpA
[00:32:22] mikecmpbll: there's lots of Array.new and Array.new(nil) causes the implicit conversion error so i'm assuming it's something like that. not sure what's with the trace.
[00:32:28] baweaver: Don't use -e
[00:32:38] baweaver: that evaluates it as a literal ruby program instead of as a file
[00:32:47] con3: ah dammit!
[00:32:54] con3: thanks baweaver
[00:32:56] baweaver: test is an actual Ruby function
[00:33:20] baweaver: hence the error
[00:34:16] con3: baweaver: any way I can get it to show the return values? Running ruby test.rb outputs nothing
[00:34:31] con3: have tried verbose mode, etc
[00:34:53] baweaver: Also return isn't needed there
[00:35:08] chouhoulis: has joined #ruby
[00:35:11] con3: baweaver: thank you so much
[00:35:20] baweaver: You have nothing that outputs to your console, STDOUT
[00:35:28] con3: that solves my problem!
[00:35:37] con3: just printed out 3
[00:35:42] baweaver: Remember though that puts returns nil
[00:35:48] baweaver: So don't use it in a method
[00:36:19] con3: would that cause the method to exit with a return value of nil?
[00:36:37] baweaver: If you use it at the end of your program it's fine
[00:36:49] baweaver: but if you put puts at the end of a method it'll return nil implicitly
[00:36:57] con3: ACTION has a long way to go
[00:37:42] baweaver: Well we're around if you need help
[00:37:54] con3: ah just added it in the method, it invalidates everything, function returns nil instead of 3. Good to know! thank you!
[00:40:43] chouhoulis: has joined #ruby
[00:40:44] con3: "The shell prints the expression whether we return or "puts" it"
[00:40:53] con3: this doesn't seem to be true ^
[00:40:58] sarink: has joined #ruby
[00:41:21] baweaver: The shell will show it, but that's STDOUT, not necessarily the return value
[00:41:26] baweaver: so it does technically print
[00:43:45] phaul: mikecmpbll: out of curiousity, how did you inherit this code, or what project is this?
[00:43:52] con3: baweaver: I'm confused then... they seem to say that return values are printed to the shell/terminal. As dar as I know this isn't the case?
[00:44:28] mikecmpbll: phaul: i don't maintain it, i'm just using it. it's maintained by sciruby
[00:44:30] baweaver: They're not
[00:44:58] mikecmpbll: the minimization project is for mathematical optimisation
[00:45:10] mikecmpbll: nelder-mead is one such algorithm
[00:46:13] chouhoulis: has joined #ruby
[00:49:58] con3: thank you baweaver :)
[00:51:47] chouhoulis: has joined #ruby
[00:53:18] ircuser: has joined #ruby
[00:54:18] phaul: well, things I spotted first look : method 78 is an interesting reinvention of spaceship. They random use return. They have classes for methods. method on 239 is waay too long and its repeating itself probably copy paste, but probably most methods are too long anyways. they use `and' when they meant &&.
[00:55:06] phaul: but the task want to criticise the code but to figure out why the error message, so probably im no help :)
[00:57:18] chouhoulis: has joined #ruby
[01:00:43] mikecmpbll: yeah. criticise away. to give the author his dues though, they are all style complaints. the code functions.
[01:01:00] al2o3-cr: has joined #ruby
[01:01:47] mikecmpbll: and his use of return is consist in that he uses it in every case that there is a method where the return value is important ;)
[01:02:33] chouhoulis: has joined #ruby
[01:06:03] uplime: has joined #ruby
[01:07:20] chouhoulis: has joined #ruby
[01:08:28] chouhoulis: has joined #ruby
[01:09:35] chouhoulis: has joined #ruby
[01:10:40] chouhoulis: has joined #ruby
[01:11:28] phaul: look, I feel sorry for you to have to work with such old code, and I am speculating the author is long gone and the code is unmaintained for almost a decade, based on sciruby activity plus the licence in the file. The author made code that's used 9 years later, most of us can't say the same so he must have done some thing right... It's just that reading the code now wouldn't fill me with much confidence,
[01:11:31] phaul: especially that probably you can't raise tickets, or contact the author. Maybe time to fork and take over?
[01:20:46] davidw: has joined #ruby
[01:21:41] chouhoulis: has joined #ruby
[01:26:58] chouhoulis: has joined #ruby
[01:27:39] GodFather: has joined #ruby
[01:31:35] chouhoulis: has joined #ruby
[01:33:26] sarink: has joined #ruby
[01:36:53] chouhoulis: has joined #ruby
[01:38:39] arekushi: has joined #ruby
[01:42:28] chouhoulis: has joined #ruby
[01:42:45] Renich_: has joined #ruby
[01:47:11] chouhoulis: has joined #ruby
[01:52:04] Renich_: has joined #ruby
[01:52:22] chouhoulis: has joined #ruby
[01:54:19] tdy: has joined #ruby
[01:54:22] rkazak: has joined #ruby
[01:56:58] chouhoulis: has joined #ruby
[01:57:18] tiff: has joined #ruby
[02:02:40] chouhoulis: has joined #ruby
[02:07:55] chouhoulis: has joined #ruby
[02:08:45] orbyt_: has joined #ruby
[02:13:00] baweaver: phaul: I always get hung up on code style arguments
[02:13:13] baweaver: On one hand it could probably be done better, but on the other it works
[02:13:25] chouhoulis: has joined #ruby
[02:13:35] baweaver: Really I think I just fall in the camp of making it mutually understandable to whoever is working with you.
[02:13:54] baweaver: Then codifying said standard to prevent shenanigans later.
[02:19:01] chouhoulis: has joined #ruby
[02:19:27] KeyJoo: has joined #ruby
[02:22:57] rkazak: has joined #ruby
[02:24:32] chouhoulis: has joined #ruby
[02:25:35] KeyJoo: has joined #ruby
[02:27:39] tdy: has joined #ruby
[02:30:27] chouhoulis: has joined #ruby
[02:35:25] Dreamer3_: has joined #ruby
[02:35:37] chouhoulis: has joined #ruby
[02:46:40] chouhoulis: has joined #ruby
[02:49:27] KeyJoo: has joined #ruby
[02:51:25] chouhoulis: has joined #ruby
[02:55:07] code_zombie: has joined #ruby
[02:56:57] chouhoulis: has joined #ruby
[03:02:04] duderonomy: has joined #ruby
[03:02:16] chouhoulis: has joined #ruby
[03:08:07] chouhoulis: has joined #ruby
[03:12:09] moei: has joined #ruby
[03:13:37] chouhoulis: has joined #ruby
[03:19:20] nowhere_man: has joined #ruby
[03:22:26] creat: has joined #ruby
[03:23:17] chouhoulis: has joined #ruby
[03:28:09] hutch: has joined #ruby
[03:29:53] chouhoulis: has joined #ruby
[03:35:28] chouhoulis: has joined #ruby
[03:41:02] chouhoulis: has joined #ruby
[03:52:04] chouhoulis: has joined #ruby
[03:54:45] rkazak: has joined #ruby
[03:56:34] sanscoeur: has joined #ruby
[03:57:59] chouhoulis: has joined #ruby
[04:02:24] chouhoulis: has joined #ruby
[04:07:37] chouhoulis: has joined #ruby
[04:08:41] rrichardsr3: has joined #ruby
[04:09:24] xlued: has joined #ruby
[04:09:31] braincrash: has joined #ruby
[04:10:35] sanscoeur: has joined #ruby
[04:12:30] tdy: has joined #ruby
[04:13:27] chouhoulis: has joined #ruby
[04:18:44] chouhoulis: has joined #ruby
[04:24:18] chouhoulis: has joined #ruby
[04:29:48] chouhoulis: has joined #ruby
[04:35:04] davidw: has joined #ruby
[04:35:22] chouhoulis: has joined #ruby
[04:38:22] sarink: has joined #ruby
[04:39:10] sarink: has joined #ruby
[04:40:11] chouhoulis: has joined #ruby
[04:50:10] chouhoulis: has joined #ruby
[04:51:14] rkazak: has joined #ruby
[04:51:19] flips_: has joined #ruby
[04:55:23] chouhoulis: has joined #ruby
[04:56:19] sarink: has joined #ruby
[05:03:28] chouhoulis: has joined #ruby
[05:05:55] tdy: has joined #ruby
[05:08:12] duderonomy: has joined #ruby
[05:09:00] chouhoulis: has joined #ruby
[05:14:02] dellavg_: has joined #ruby
[05:14:12] chouhoulis: has joined #ruby
[05:19:47] chouhoulis: has joined #ruby
[05:24:33] chouhoulis: has joined #ruby
[05:25:09] hutch: has joined #ruby
[05:29:42] chouhoulis: has joined #ruby
[05:32:23] dinfuehr: has joined #ruby
[05:35:15] chouhoulis: has joined #ruby
[05:37:24] dinfuehr: has joined #ruby
[05:38:24] nowhere_man: has joined #ruby
[05:41:04] chouhoulis: has joined #ruby
[05:41:30] marmotini_: has joined #ruby
[05:42:07] rrichardsr3: has joined #ruby
[05:43:00] hutch: has joined #ruby
[05:46:22] chouhoulis: has joined #ruby
[05:48:26] DTZUZO: has joined #ruby
[05:52:11] chouhoulis: has joined #ruby
[05:57:18] tdy: has joined #ruby
[05:57:25] chouhoulis: has joined #ruby
[05:58:17] reber: has joined #ruby
[06:03:17] chouhoulis: has joined #ruby
[06:08:32] chouhoulis: has joined #ruby
[06:08:52] Fusl: has joined #ruby
[06:13:33] grvgr: has joined #ruby
[06:14:04] esrse: has joined #ruby
[06:14:05] chouhoulis: has joined #ruby
[06:19:53] chouhoulis: has joined #ruby
[06:21:16] conta: has joined #ruby
[06:25:08] chouhoulis: has joined #ruby
[06:30:35] Cthulu201: has joined #ruby
[06:30:52] chouhoulis: has joined #ruby
[06:36:18] chouhoulis: has joined #ruby
[06:37:57] sanscoeur: has joined #ruby
[06:38:12] maufart__: has joined #ruby
[06:39:18] mozzarella: has joined #ruby
[06:42:03] chouhoulis: has joined #ruby
[06:47:19] chouhoulis: has joined #ruby
[06:53:10] chouhoulis: has joined #ruby
[06:58:25] chouhoulis: has joined #ruby
[07:03:57] chouhoulis: has joined #ruby
[07:05:47] Nicmavr: has joined #ruby
[07:09:00] Leopere: has joined #ruby
[07:09:32] chouhoulis: has joined #ruby
[07:15:02] chouhoulis: has joined #ruby
[07:18:44] aupadhye: has joined #ruby
[07:20:07] duderonomy: has joined #ruby
[07:20:54] chouhoulis: has joined #ruby
[07:25:41] Xiti`: has joined #ruby
[07:26:10] chouhoulis: has joined #ruby
[07:33:47] Xiti: has joined #ruby
[07:34:25] AlHafoudh: has joined #ruby
[07:36:22] chouhoulis: has joined #ruby
[07:38:22] akem: has joined #ruby
[07:40:54] profetes: has joined #ruby
[07:41:56] chouhoulis: has joined #ruby
[07:51:11] ansraliant: has joined #ruby
[07:52:53] chouhoulis: has joined #ruby
[07:52:59] djdduty: has joined #ruby
[07:58:36] chouhoulis: has joined #ruby
[08:02:40] aupadhye: has joined #ruby
[08:07:29] aupadhye: has joined #ruby
[08:08:26] chouhoulis: has joined #ruby
[08:13:04] chouhoulis: has joined #ruby
[08:13:27] clemens3: has joined #ruby
[08:13:29] s2013: has joined #ruby
[08:17:27] sauvin: has joined #ruby
[08:19:24] chouhoulis: has joined #ruby
[08:25:00] chouhoulis: has joined #ruby
[08:30:27] chouhoulis: has joined #ruby
[08:33:09] aupadhye: has joined #ruby
[08:35:54] hahuang65: has joined #ruby
[08:35:59] chouhoulis: has joined #ruby
[08:41:33] chouhoulis: has joined #ruby
[08:47:05] chouhoulis: has joined #ruby
[08:49:16] aupadhye: has joined #ruby
[08:51:51] chouhoulis: has joined #ruby
[08:52:50] chouhoulis: has joined #ruby
[08:58:10] chouhoulis: has joined #ruby
[09:00:59] nowhere_man: has joined #ruby
[09:03:12] ur5us: has joined #ruby
[09:03:40] chouhoulis: has joined #ruby
[09:06:17] mikecmpbll: has joined #ruby
[09:09:31] chouhoulis: has joined #ruby
[09:17:10] thebigj: has left #ruby: ()
[09:25:50] chouhoulis: has joined #ruby
[09:27:50] aupadhye: has joined #ruby
[09:31:44] chouhoulis: has joined #ruby
[09:36:55] chouhoulis: has joined #ruby
[09:41:53] marz_d`ghostman: has joined #ruby
[09:42:07] marz_d`ghostman: Why am I getting an error: mirror_manager.rb:74:in `block in <class:Manager>': undefined method `send_error_notification' for Rise::MirrorManager::Manager:Class (NoMethodError) for my code: https://termbin.com/denk
[09:42:38] neuraload: has joined #ruby
[09:42:50] chouhoulis: has joined #ruby
[09:42:54] marz_d`ghostman: I meant: https://termbin.com/xgp2
[09:43:31] saTchymoto: has joined #ruby
[09:47:30] ellcs: has joined #ruby
[09:48:15] chouhoulis: has joined #ruby
[09:50:36] phaul: because Rise::MirrorManager::Manager does not have send_error_notification method. I bet it has an instance method with that name, that comes from the included Rise::MirrorManager::Notification.
[09:51:25] phaul: but the existance of the instance method is just speculation. What the error says is that there is no class method
[09:53:19] aupadhye: has joined #ruby
[09:53:32] chouhoulis: has joined #ruby
[09:54:20] marz_d`ghostman: phaul: It does, does it matter if it's private or not? I think I'm calling it inside the object context. Perhaps I'm wrong with this at_exit method
[09:58:04] lxsameer: has joined #ruby
[09:58:45] phaul: it doesn't matter if it's private.
[09:59:02] chouhoulis: has joined #ruby
[09:59:03] phaul: you are calling it in class context
[10:00:37] phaul: ah the instance method is defined just a few lines up on line 47, not included from the module.
[10:01:03] marz_d`ghostman: I tried invoking the method directly via Rise::MirrorManager::Notification.send_slack_message, but it gives me the same error
[10:02:24] phaul: class X; def x; end; end # is x class or instance method in this example?
[10:03:35] leftylink: &>> at_exit { p :Etesting }
[10:03:38] rubydoc: # => #<Proc:0x000056538b10cb80@-e:2> ...check link for more (https://carc.in/#/r/5yru)
[10:03:43] leftylink: oops ,accidental E
[10:03:55] leftylink: unfortunately, either way guess this is not helpful
[10:04:42] leftylink: oh, but it does get shown in the link
[10:04:47] marz_d`ghostman: Ah, I made the module method as a class method via module_function so I can call it in class context
[10:04:57] chouhoulis: has joined #ruby
[10:06:38] fiachetti: has joined #ruby
[10:07:16] phaul: send_error_notification is defined in the class as an instance method on line 47, and is not a module_function. unless you also define it in modules that you don't show us
[10:10:08] chouhoulis: has joined #ruby
[10:12:11] phaul: &>> class X; at_exit { p self }; end
[10:12:13] rubydoc: # => #<Proc:0x00005651496ab738@-e:2> ...check link for more (https://carc.in/#/r/5yrv)
[10:15:37] chouhoulis: has joined #ruby
[10:21:13] chouhoulis: has joined #ruby
[10:22:06] phaul: to reproduce this with a minimal example:
[10:22:39] phaul: &>> class Manager; def send_error_notification; end; at_exit { send_error_notification }; end
[10:22:40] rubydoc: # => #<Proc:0x00005615af300cd0@-e:2> (https://carc.in/#/r/5yrx)
[10:26:47] chouhoulis: has joined #ruby
[10:31:47] neuraload: has joined #ruby
[10:32:16] chouhoulis: has joined #ruby
[10:38:10] chouhoulis: has joined #ruby
[10:43:22] chouhoulis: has joined #ruby
[10:48:05] chouhoulis: has joined #ruby
[10:49:52] fiachetti: has joined #ruby
[10:49:57] armyriad: has joined #ruby
[10:53:10] ellcs: has joined #ruby
[10:53:20] chouhoulis: has joined #ruby
[10:58:07] chouhoulis: has joined #ruby
[11:03:37] chouhoulis: has joined #ruby
[11:08:55] chouhoulis: has joined #ruby
[11:14:30] chouhoulis: has joined #ruby
[11:14:52] Cthulu201: has joined #ruby
[11:19:56] chouhoulis: has joined #ruby
[11:25:48] chouhoulis: has joined #ruby
[11:31:18] chouhoulis: has joined #ruby
[11:42:26] chouhoulis: has joined #ruby
[11:43:08] sarink: has joined #ruby
[11:43:30] chouhoulis: has joined #ruby
[11:45:05] conta: has joined #ruby
[11:45:17] nertzy: has joined #ruby
[11:48:22] grvgr: has joined #ruby
[11:49:00] chouhoulis: has joined #ruby
[11:49:00] SqREL: has joined #ruby
[11:54:14] chouhoulis: has joined #ruby
[11:57:51] akem: has joined #ruby
[12:00:10] chouhoulis: has joined #ruby
[12:04:35] saTchymoto: has joined #ruby
[12:05:18] chouhoulis: has joined #ruby
[12:10:55] chouhoulis: has joined #ruby
[12:13:15] vonfry: has joined #ruby
[12:15:20] chouhoulis: has joined #ruby
[12:17:01] status402: has joined #ruby
[12:20:50] chouhoulis: has joined #ruby
[12:26:45] chouhoulis: has joined #ruby
[12:32:00] chouhoulis: has joined #ruby
[12:37:32] chouhoulis: has joined #ruby
[12:39:32] lucasb: has joined #ruby
[12:43:02] chouhoulis: has joined #ruby
[12:48:53] chouhoulis: has joined #ruby
[12:53:19] chouhoulis: has joined #ruby
[12:53:30] donofrio: has joined #ruby
[12:54:24] con3: has joined #ruby
[12:54:31] catphish: has joined #ruby
[12:54:57] catphish: i have a requirement to run http requests though an ssh connection (in ruby) - is there an obvious approach to this?
[12:55:27] saTchymoto: has joined #ruby
[12:56:26] catphish: if net::ssh can do port forwarding channels, and i can get net::http to use one, that would be the best
[12:58:10] fiachetti: has joined #ruby
[12:58:55] chouhoulis: has joined #ruby
[12:59:53] am0123_: has joined #ruby
[13:00:05] am0123_: Hi guys !!
[13:00:25] phaul: am0123_: hi
[13:02:42] am0123_: I'm struggling with this switch case that I found on hackerrank
[13:02:44] am0123_: https://repl.it/repls/IntelligentOrdinaryLicenses
[13:03:09] am0123_: it looks correct for me
[13:03:14] catphish: it's nonsense
[13:03:45] gregf_: has joined #ruby
[13:04:16] am0123_: even if I change "case true" with "case char"
[13:04:25] chouhoulis: has joined #ruby
[13:04:29] catphish: i can see how that works, but it's functionally no different to: if ("A".."M").include?(char) == true; puts "hoho"; end
[13:05:12] catphish: i believe the correct approach: case char; when ("A".."M"); puts "hoho"; end
[13:05:26] status402: has joined #ruby
[13:05:34] catphish: the point of case is that it compares each "when" item to the "case" item
[13:07:12] am0123_: case char when ("A".."M") puts "hoho" end .... is much better
[13:07:16] bijan_: has joined #ruby
[13:07:20] catphish: https://repl.it/repls/TragicImpoliteDigit
[13:07:54] bijan_: Hi is anyone using Textmate2 for Rails with ctags? Wondering how to get gems also included...
[13:08:09] catphish: you can puts within the case statement, or it can return a value as in my link example
[13:08:49] catphish: am0123_: good luck :)
[13:09:55] chouhoulis: has joined #ruby
[13:10:52] am0123_: Now, I don't understand why does `when ("A".."M").include? char` not work while `when (("A".."M").include? char)==true` ? both of the return true of false !!
[13:13:21] catphish: `when ("A".."M").include? char` should work... it evaluates to true when the char is in that range
[13:13:34] catphish: then the case statement compares true with true
[13:14:13] catphish: it's just a horrible way to use "case", you might as well just use if and elsif
[13:15:00] apparition: has joined #ruby
[13:16:04] am0123_: I believe that it's a horrible code XD ... but the interpreter seems reject this code
[13:16:07] am0123_: syntax error, unexpected tIDENTIFIER, expecting keyword_then or ',' or ';' or '\n'
[13:16:07] am0123_: when ("A".."M").include? char
[13:16:22] catphish: try using parenthesis
[13:16:32] catphish: ("A".."M").include?(char)
[13:16:51] catphish: ruby allows method calls without them, but sometimes it's ambiguous and hence not valid
[13:17:00] catphish: i prefer to always use them
[13:17:53] am0123_: It's accepted now
[13:17:58] am0123_: thank you :)
[13:19:47] catphish: don't do "case true" though
[13:20:01] catphish: if you find yourself doing that, just use "if"
[13:21:00] phaul: as a side not there is a boolean case syntax in ruby with ommitting the expression after the case, and just listing whens.
[13:21:00] chouhoulis: has joined #ruby
[13:21:34] catphish: phaul: interesting
[13:21:49] phaul: &>> case; when 3.odd? then 'odd'; when 3.even?; then 'even'; end
[13:21:50] rubydoc: # => "odd" (https://carc.in/#/r/5ysx)
[13:21:54] catphish: i'd always prefer elsif, but i geuss boolean case has a place
[13:22:07] catphish: they're functionally identical
[13:26:09] neuraload: has joined #ruby
[13:26:26] kapil____: has joined #ruby
[13:26:30] chouhoulis: has joined #ruby
[13:31:03] chouhoulis: has joined #ruby
[13:32:04] chouhoulis: has joined #ruby
[13:33:37] troulouliou_div2: has joined #ruby
[13:34:24] lxsameer: has joined #ruby
[13:36:33] chouhoulis: has joined #ruby
[13:41:50] akem: has joined #ruby
[13:47:16] chouhoulis: has joined #ruby
[13:48:15] uplime: has joined #ruby
[13:50:30] DTZUZO: has joined #ruby
[13:52:00] chouhoulis: has joined #ruby
[13:57:33] chouhoulis: has joined #ruby
[14:03:07] chouhoulis: has joined #ruby
[14:04:39] nertzy: has joined #ruby
[14:04:49] troulouliou_div2: has joined #ruby
[14:07:59] ViperChief: has joined #ruby
[14:08:38] chouhoulis: has joined #ruby
[14:14:06] chouhoulis: has joined #ruby
[14:15:09] ellcs: has joined #ruby
[14:18:38] chouhoulis: has joined #ruby
[14:27:25] status402: has joined #ruby
[14:28:06] davidw: has joined #ruby
[14:28:33] chouhoulis: has joined #ruby
[14:34:05] chouhoulis: has joined #ruby
[14:37:24] conta: has joined #ruby
[14:38:28] bak1an: has joined #ruby
[14:39:20] chouhoulis: has joined #ruby
[14:41:23] GinoMan: has joined #ruby
[14:44:51] chouhoulis: has joined #ruby
[14:45:15] ohcibi: has joined #ruby
[14:49:27] twobitsprite: has joined #ruby
[14:49:46] uplime: has joined #ruby
[14:59:20] maryo: has joined #ruby
[15:08:09] rippa: has joined #ruby
[15:10:27] conta: has joined #ruby
[15:16:15] NL3limin4t0r_afk: &>> case 3; when :odd?.to_proc then 'odd'; when :even?.to_proc then 'even'; end
[15:16:17] rubydoc: # => "odd" (https://carc.in/#/r/5yto)
[15:16:42] Rapture: has joined #ruby
[15:20:16] hutch: has joined #ruby
[15:21:09] GodFather: has joined #ruby
[15:27:36] conta2: has joined #ruby
[15:33:22] d^sh: has joined #ruby
[15:36:05] neuraload: has joined #ruby
[15:36:38] polishdub: has joined #ruby
[15:38:14] ogres: has joined #ruby
[15:40:08] tkonto: has joined #ruby
[15:40:09] zenogais: has joined #ruby
[15:40:47] tkonto: hi all very new to ruby/rails.... need the following... response = RestClient::Request.new(params).execute
[15:41:05] tkonto: if error code !=200 || 201 then retry
[15:41:22] tkonto: I am accessing some external APIs but from time to time a retry is all required.
[15:42:02] tkonto: however unless response.code == 200 || response.code == 201 retry is not vald
[15:43:53] canton7: tkonto, 'unless' with two cases gets confusing fast: don't do it
[15:44:39] canton7: you probably want 'if errorcode != 200 && errorcode != 201' or 'if !(errorcode == 200 || errorcode == 201)'
[15:45:11] canton7: and the syntax is 'if errorcode != 200 && errorcode != 201 <newline> retry <newline> end' or 'retry if errorcode != 200 && errorcode != 201'
[15:47:53] d^sh_: has joined #ruby
[15:58:46] mspo: yeah stay positive when possible :)
[15:58:47] r29v: has joined #ruby
[15:59:02] mspo: it's too easy to OR yourself into an always-true or always-false
[16:05:05] baweaver: Honestly I tend to use `include?` to make it more readable
[16:05:21] baweaver: if %w(200 201).include?(response.code)
[16:05:36] havenwood: I was going to say what baweaver said ^ too.
[16:05:42] baweaver: or `in?`: if response.code.in?(%w(200 201))
[16:06:07] havenwood: That extra Array is worth the allocation for expressiveness. Or use TruffleRuby so it folds away. ;P
[16:06:18] baweaver: If people get uppity about performance, just make it a constant
[16:06:45] SeepingN: has joined #ruby
[16:06:45] baweaver: though really by that point it just gets incredibly pedantic
[16:06:58] phaul: or ask them to measure performance. that usually keeps them busy ;)
[16:07:32] baweaver: I just quote Jira numbers at them that they haven't finished yet.
[16:08:04] mspo: newb question- what is the %w(foo bar) doing there?
[16:08:21] baweaver: &>> %w(foo bar baz)
[16:08:23] rubydoc: # => ["foo", "bar", "baz"] (https://carc.in/#/r/5ytu)
[16:09:43] mspo: I was wanting to see the ["200", "201"] form :)
[16:10:08] havenwood: mspo: Another way you'll commonly see it with %w is with braces: %w[200 201]
[16:10:17] havenwood: &>> %w[200 201]
[16:10:18] rubydoc: # => ["200", "201"] (https://carc.in/#/r/5ytv)
[16:10:57] havenwood: mspo: An advantage is node calling #code twice.
[16:11:10] baweaver: &>> %w{ha ha} + %w|ha ha| + %w+ha ha+
[16:11:11] rubydoc: # => ["ha", "ha", "ha", "ha", "ha", "ha"] (https://carc.in/#/r/5ytx)
[16:11:26] baweaver: Do not look to the person behind the curtain
[16:11:33] GinoMan2440: has joined #ruby
[16:11:52] baweaver: Also most code I write should come with a warning label and disclaimer
[16:14:00] Dbugger: has joined #ruby
[16:21:25] davidw: has joined #ruby
[16:22:15] Inline: has joined #ruby
[16:24:35] chouhoulis: has joined #ruby
[16:25:55] twobitsprite: has joined #ruby
[16:30:03] chouhoulis: has joined #ruby
[16:34:50] chouhoulis: has joined #ruby
[16:46:02] grvgr: has joined #ruby
[16:46:30] orbyt_: has joined #ruby
[16:46:50] GinoMan: has joined #ruby
[16:48:53] akem: has joined #ruby
[16:49:44] \void: has joined #ruby
[16:49:45] sanscoeur: has joined #ruby
[16:50:13] Blaguvest: has joined #ruby
[16:55:19] grvgr_: has joined #ruby
[17:03:31] bak1an: has joined #ruby
[17:09:45] d^sh: has joined #ruby
[17:10:16] nowhere_man: has joined #ruby
[17:22:00] chouhoulis: has joined #ruby
[17:23:49] sanscoeur: has joined #ruby
[17:32:36] cthulchu: has joined #ruby
[17:33:15] eddof13: has joined #ruby
[17:34:08] dviola: has joined #ruby
[17:38:00] sanscoeur: has joined #ruby
[17:38:51] am0123_: has joined #ruby
[17:45:31] Nicmavr: has joined #ruby
[17:48:53] akemot: has joined #ruby
[17:51:22] akem: has joined #ruby
[17:53:13] cthu|: has joined #ruby
[17:55:52] akem: has joined #ruby
[17:58:22] mikecmpbll: has joined #ruby
[18:02:00] Aqo: has joined #ruby
[18:06:20] akem: has joined #ruby
[18:08:59] r29v: has joined #ruby
[18:09:22] akem: has joined #ruby
[18:09:37] r29v: has joined #ruby
[18:12:53] akem: has joined #ruby
[18:14:46] cthulchu: has joined #ruby
[18:15:00] orbyt_: has joined #ruby
[18:27:17] hiroaki: has joined #ruby
[18:28:23] akem: has joined #ruby
[18:33:51] akem: has joined #ruby
[18:35:29] tkonto: has joined #ruby
[18:35:51] cthu|: has joined #ruby
[18:37:00] akem: has joined #ruby
[18:38:14] d^sh_: has joined #ruby
[18:40:01] gix: has joined #ruby
[18:40:52] jnix: has joined #ruby
[18:46:39] reber: has joined #ruby
[18:48:39] code_zombie: has joined #ruby
[18:52:18] sameerynho: has joined #ruby
[18:53:59] orbyt_: has joined #ruby
[18:55:42] sanscoeur: has joined #ruby
[19:03:13] mozzarella: has joined #ruby
[19:04:10] dviola: just got a rejection because apparently my code isn't too sandimetz-y
[19:04:20] dviola: one day, one day...
[19:08:44] SeepingN: has joined #ruby
[19:08:47] tdy: has joined #ruby
[19:11:01] orbyt_: has joined #ruby
[19:11:11] phaul: dviola: take that with a pinch of salt
[19:13:44] phaul: SM also said first we should just "throw code at the wall and see what sticks".
[19:14:31] hiroaki: has joined #ruby
[19:18:07] phaul: they meant isn't sandimetz-y _enough_ - right?
[19:19:12] dviola: "A single class/object (`People`) that handles all operations and holds all state is not enough OOP for what we're looking for."
[19:19:57] chouhoulis: has joined #ruby
[19:20:26] mspo: OOP more, obviously
[19:21:04] mspo: they wanted more inheritance?
[19:21:17] dviola: I didn't ask
[19:21:57] dviola: I replied saying I looked at their repos and couldn't find a single one that the reflects the style they are looking for
[19:22:10] mspo: was this an interview?
[19:22:21] mspo: that is weirdly specific
[19:22:33] mspo: without a *lot* of very specific guidance being given
[19:22:46] profetes: has joined #ruby
[19:23:10] dviola: he also said this:
[19:23:13] dviola: "The extension task/requirement, in our tech interview, would've been very difficult with your solution. You would've had to have done quite a bit of live refactoring. Just saving both of us the trouble. Yes, "not enough OOP" is an entirely subjective opinion, and it's just about compatibility/fit, rather than right/wrong. You have zero reason to change your coding style from this interview."
[19:24:03] mspo: so there were followup things in the in-person
[19:24:13] mspo: and he didn't think your initial take-home was flexible enough to solve those
[19:24:36] dviola: it was for a remote position
[19:28:02] mspo: dviola: clearly you can only ever write in a single style and would never absorb institutional practices
[19:30:09] dviola: ACTION reads the POODR
[19:36:18] twobitsprite: has joined #ruby
[19:38:29] maryo_: has joined #ruby
[19:41:28] phaul: this also reminds me the break up phrase "it's not you - it's me". Thanks very much. we all know what that means. If they beleive in what they are saying they should at least stand by it, rather than this "fit/compatibility" nonsese. Also introducing classes for the sake of it is just stupid and nothing more but cargo cult programming.
[19:44:07] tomaw: has joined #ruby
[19:48:04] crankharder: has joined #ruby
[19:48:11] d^sh: has joined #ruby
[19:50:32] dviola: silver bullet thinking
[19:58:01] Wafficus: has joined #ruby
[19:58:57] Wafficus: hi there is Learn Ruby The Hard Way a good beginner resource? if not, what is a better one?
[20:04:16] GinoMan2440: has joined #ruby
[20:09:26] fiachetti: has joined #ruby
[20:11:21] duderonomy: has joined #ruby
[20:16:01] Wafficus: whats a good beginner book?
[20:18:54] TheNet: Wafficus: do you have existing programming experience?
[20:20:50] Wafficus: yeah in python
[20:20:58] Wafficus: halfway through automate the boring stuff
[20:21:11] Wafficus: and have a few webscrapers that post oj twitter
[20:24:05] sarink: has joined #ruby
[20:25:26] TheNet: The Well Grounded Rubyist – https://www.manning.com/books/the-well-grounded-rubyist-third-edition
[20:29:22] Wafficus: how would you compare this with learn ruby the hard way
[20:29:32] Wafficus: this book looks good though
[20:31:10] mspo: lrthw has a good price ;)
[20:34:11] sarink: has joined #ruby
[20:36:27] fiachetti: has joined #ruby
[20:37:37] ur5us: has joined #ruby
[20:38:56] snuz: has joined #ruby
[20:43:08] tdy: has joined #ruby
[20:46:20] Fernando-Basso: has joined #ruby
[20:49:26] troulouliou_div2: has joined #ruby
[20:51:26] spacesuitdiver: has joined #ruby
[21:00:48] zenspider_: Wafficus: how much of a beginner?
[21:03:34] zenspider_: dviola: I'm curious... What was the interview problem? I've had a few rejections lately and I don't even get feedback.
[21:04:11] arup_r: has joined #ruby
[21:04:39] mspo: yeah getting feedback at all is super weird
[21:04:48] mspo: usually it's just ghost you for a month :)
[21:06:53] SeepingN: So my issue with the console not returning numeric values is something to do with "wirb"
[21:07:00] mspo: luckily you only have to deal with working for 40 years or so
[21:07:15] zenspider_: I don't get ghosted (yet?) ... just "no"
[21:08:39] zenspider: mspo: we'll see about that... guess I'm most of the way there. :P
[21:09:57] mspo: zenspider: most of the way into your 40 years of work?
[21:10:01] dviola: zenspider: https://github.com/remotelock/public/blob/master/backend_challenge.md
[21:10:32] dviola: zenspider: lol
[21:12:14] Wafficus: zenspider: www.musimatic.net is my site so let me know if im too much a be beginner
[21:18:08] dviola: that's just sad
[21:19:26] gix: has joined #ruby
[21:34:39] Iambchop: Wafficus: I have LRTHW and it looks like a fine option. If its style works for you, go with it; the channel topic has a link to more book suggestions: https://goo.gl/wpGhoQ
[21:35:18] Wafficus: cool thanks
[21:42:49] drale2k_: has joined #ruby
[21:49:54] arquebus: has joined #ruby
[21:56:17] ivanskie: has joined #ruby
[21:56:38] orbyt_: has joined #ruby
[22:00:03] Azure: has joined #ruby
[22:01:40] phaul: Wafficus: are you aware of https://sonic-pi.net/ ?
[22:01:46] phaul: you might like it
[22:02:17] baweaver: phaul: Speaking of, want to see something fun?
[22:02:28] phaul: hit me :)
[22:06:56] tiff: has joined #ruby
[22:08:23] drale2k_: has joined #ruby
[22:08:38] sputnik13: has joined #ruby
[22:08:51] saysjonathan: has joined #ruby
[22:09:57] saysjonathan: has joined #ruby
[22:10:39] fowlduck: has joined #ruby
[22:13:34] saysjonathan: has joined #ruby
[22:16:49] zenspider: dviola: that is so poorly described... I'm not sure I even get it.
[22:18:13] ivanskie: can a guard line be 'continue' or something like that in a method?
[22:18:30] ivanskie: oh nevermind
[22:19:22] sputnik13: has joined #ruby
[22:19:23] zenspider: ivanskie: break/redo/next/retry... detailed in my quickref
[22:23:57] ltd: has joined #ruby
[22:24:18] tdy: has joined #ruby
[22:31:20] akem: has joined #ruby
[22:35:01] dviola: zenspider: yep, I think I had to read it multiples times before it started making sense
[22:38:48] ellcs: has joined #ruby
[22:42:39] drale2k_: has joined #ruby
[22:45:47] sputnik13: has joined #ruby
[22:52:37] AJA4350: has joined #ruby
[22:54:41] uplime: has joined #ruby
[22:59:06] saysjonathan: has joined #ruby
[23:12:43] orbyt_: has joined #ruby
[23:13:20] jenrzzz: has joined #ruby
[23:16:11] RougeR: has joined #ruby
[23:29:44] tdy: has joined #ruby
[23:35:15] sputnik13: has joined #ruby
[23:37:50] tdy: has joined #ruby
[23:40:09] s3nd1v0g1us: has joined #ruby
[23:52:01] cd: has joined #ruby
[23:55:41] orbyt_: has joined #ruby
[23:56:49] drale2k_: has joined #ruby
[23:58:23] spacesuitdiver: has joined #ruby