« Back to channel list

#ruby - 10 September 2017

« Back 1 day Forward 1 day »
[00:02:07] brent__: has joined #ruby
[00:04:40] nopolitica: has joined #ruby
[00:11:46] gusrub_: has joined #ruby
[00:12:41] mtkd: has joined #ruby
[00:19:21] vondruch: has joined #ruby
[00:23:38] AndBobsYourUncle: has joined #ruby
[00:27:38] cosmicz: has joined #ruby
[00:38:04] Cohedrin_: has joined #ruby
[00:39:17] Prototype: has joined #ruby
[00:39:22] vondruch: has joined #ruby
[00:43:52] vondruch: has joined #ruby
[00:44:38] nacsurte: has joined #ruby
[00:45:39] AxelAlex: has joined #ruby
[00:49:24] vondruch: has joined #ruby
[00:53:56] vondruch: has joined #ruby
[00:56:57] cconstantine: has joined #ruby
[00:59:57] GodFather: has joined #ruby
[01:01:00] AxelAlex: has joined #ruby
[01:06:01] joelwallis: has joined #ruby
[01:09:22] vondruch: has joined #ruby
[01:11:47] troubled: has joined #ruby
[01:12:53] Guest16898: I'm running into an issue with strings where random letters are being added in
[01:12:58] Guest16898: http://imgur.com/a/GVJ6A
[01:13:20] Guest16898: this is for a class, the rspec files are given to us and our code is expected to pass the tests
[01:13:56] vondruch: has joined #ruby
[01:14:13] charliesome: has joined #ruby
[01:14:20] Guest16898: in the imgur link, you can see the extra Fs and a . that areadded
[01:14:32] Guest16898: and my code that is producing the strings
[01:15:01] Radar: Guest16898: the Fs are RSpec telling you that tests are failing. The dot is RSpec telling you the test is passing.
[01:15:48] sneakerhax: has joined #ruby
[01:16:30] Guest16898: Radar: do you have an idea why the "A man a plan..." is failing then?
[01:16:54] Guest16898: nevermind, i see
[01:17:14] jackjackdripper: has joined #ruby
[01:22:37] pi4: has joined #ruby
[01:24:05] Radar: Guest34710: https://gist.github.com next time please :)
[01:24:13] Radar: Whoops, wrong guest.
[01:24:20] vondruch: has joined #ruby
[01:24:23] Radar: ... and they're gone anyway :(
[01:25:31] gizmore: has joined #ruby
[01:25:56] gusrub: has joined #ruby
[01:30:42] govg: has joined #ruby
[01:35:32] cconstantine: has joined #ruby
[01:38:38] nacsurte: has joined #ruby
[01:42:58] wlycdgr1: has joined #ruby
[01:44:16] tcopeland: Guest16898 we hardly knew ye
[01:44:24] runescape07rsps: has joined #ruby
[01:46:54] nicesignal: has joined #ruby
[01:48:46] kies: has joined #ruby
[01:49:22] vondruch: has joined #ruby
[01:50:00] Jameser: has joined #ruby
[01:51:46] meadmoon: has joined #ruby
[01:53:12] bronson: has joined #ruby
[01:53:52] vondruch: has joined #ruby
[01:55:02] arescorpio: has joined #ruby
[01:55:36] d^sh: has joined #ruby
[01:59:34] SuperLag: has joined #ruby
[02:03:34] eb0t: has joined #ruby
[02:04:03] detectiveaoi: has joined #ruby
[02:06:41] SuperL4g: has joined #ruby
[02:09:25] vondruch: has joined #ruby
[02:13:52] vondruch: has joined #ruby
[02:18:37] joast: has joined #ruby
[02:19:22] vondruch: has joined #ruby
[02:26:32] jordanm: has joined #ruby
[02:27:13] xuanrui: has joined #ruby
[02:28:52] vondruch: has joined #ruby
[02:29:12] __Yiota: has joined #ruby
[02:32:43] nacsurte: has joined #ruby
[02:34:24] vondruch: has joined #ruby
[02:36:29] houhoulis: has joined #ruby
[02:42:03] mochiyoda_: has joined #ruby
[02:42:28] harai: has joined #ruby
[02:43:52] vondruch: has joined #ruby
[02:45:41] apparition: has joined #ruby
[02:45:56] AndBobsYourUncle: has joined #ruby
[02:49:24] vondruch: has joined #ruby
[02:58:54] vondruch: has joined #ruby
[03:00:09] cadillac_: has joined #ruby
[03:03:09] jackjackdripper: has joined #ruby
[03:05:02] arvindsaik: has joined #ruby
[03:05:03] juggler: has joined #ruby
[03:05:04] moei: has joined #ruby
[03:05:40] Jameser: has joined #ruby
[03:08:28] Sembei: has joined #ruby
[03:10:35] sorah___: has joined #ruby
[03:11:19] creat: has joined #ruby
[03:12:09] rfshark: has joined #ruby
[03:12:41] znz_jp: has joined #ruby
[03:16:19] rfshark: ##hamradio
[03:17:07] rfshark: lol i get up too early :|
[03:21:07] neo95: has joined #ruby
[03:21:10] _whitelogger: has joined #ruby
[03:24:23] vondruch: has joined #ruby
[03:26:46] xall: has joined #ruby
[03:26:50] nacsurte: has joined #ruby
[03:27:39] nopoliti1: has joined #ruby
[03:28:44] wlycdgr1: has joined #ruby
[03:28:56] vondruch: has joined #ruby
[03:31:37] harai: has joined #ruby
[03:39:21] vondruch: has joined #ruby
[03:43:17] enterprisey: has joined #ruby
[03:43:52] vondruch: has joined #ruby
[03:46:39] milardovich: has joined #ruby
[03:48:04] tcopeland: has joined #ruby
[03:48:15] milardovich: has joined #ruby
[03:49:24] vondruch: has joined #ruby
[03:51:15] Jameser: has joined #ruby
[03:52:17] opekktar: has joined #ruby
[03:53:56] vondruch: has joined #ruby
[03:54:48] bronson: has joined #ruby
[03:55:51] detectiveaoi: has joined #ruby
[03:57:19] imode: has joined #ruby
[03:59:24] vondruch: has joined #ruby
[04:13:53] vondruch: has joined #ruby
[04:19:23] vondruch: has joined #ruby
[04:20:58] nacsurte: has joined #ruby
[04:25:10] s3nd1v0g1us: has joined #ruby
[04:26:41] cam27: has joined #ruby
[04:28:25] s3nd1v0g1us: has joined #ruby
[04:29:12] ged: has joined #ruby
[04:29:36] s3nd1v0g1us: has joined #ruby
[04:31:09] s3nd1v0g1us: has joined #ruby
[04:34:20] vondruch: has joined #ruby
[04:43:54] vondruch: has joined #ruby
[04:47:02] cconstantine: has joined #ruby
[04:49:22] vondruch: has joined #ruby
[04:58:52] vondruch: has joined #ruby
[05:01:19] djbkd: has joined #ruby
[05:01:53] mtkd: has joined #ruby
[05:09:10] _whitelogger: has joined #ruby
[05:09:20] cconstantine: has joined #ruby
[05:15:00] nacsurte: has joined #ruby
[05:20:09] eputnam: has joined #ruby
[05:29:23] vondruch: has joined #ruby
[05:33:54] vondruch: has joined #ruby
[05:47:20] MyMind: has joined #ruby
[05:49:22] vondruch: has joined #ruby
[05:53:52] vondruch: has joined #ruby
[05:55:28] bronson: has joined #ruby
[05:57:24] devyn: has joined #ruby
[06:08:03] Sabicas: has joined #ruby
[06:09:06] nacsurte: has joined #ruby
[06:09:28] Sabicas: I'm new to Ruby and needs some advice/guidance if anyone is around
[06:10:17] taurgal: has joined #ruby
[06:12:20] conta: has joined #ruby
[06:13:35] conta: has joined #ruby
[06:16:55] Sabicas_: has joined #ruby
[06:17:35] Sabicas_: Test from mobile client
[06:18:11] rippa: has joined #ruby
[06:21:21] havenwood: Sabicas: hi
[06:21:35] AndBobsYourUncle: has joined #ruby
[06:21:51] Sabicas: havenwood, hello
[06:22:27] havenwood: Sabicas: What sort of advice are you looking for?
[06:23:35] Sabicas: I want to learn Ruby and am looking at building a personal project. I have coding experience, mostly PHP and javascript. I just need some advice on where to start and if Ruby is the right language for what I want to attempt
[06:25:00] Sabicas: I'm still here, that's my mobile nick that quit.
[06:29:46] syamaoka: has joined #ruby
[06:32:06] havenwood: Sabicas: So in Ruby you *can* use CGI similar to how PHP does it but it's not a popular option for various reasons: http://www.mikeperham.com/2015/01/05/cgi-rubys-bare-metal/
[06:32:18] Lyubo1: has joined #ruby
[06:32:20] havenwood: Sabicas: In Ruby we mostly make Rack apps: https://rack.github.io/
[06:33:09] havenwood: Sabicas: You can make a pure Rack app, or there are a variety of Rack adapters.
[06:33:39] havenwood: Sabicas: Here are a bunch of "Hello Word"s in Rack and various Rack adapters: https://github.com/luislavena/bench-micro/tree/master/apps
[06:34:06] havenwood: Sabicas: Rails is of course a very popular Rack adapter. Sinatra is very well known as well.
[06:34:22] vondruch: has joined #ruby
[06:34:43] havenwood: Sabicas: I'd suggest looking at the micro-bench Rack example and then trying a stab at your own little Rack app.
[06:35:10] Sabicas: I'm already a little lost. What is a "rack". Why do I need it?
[06:36:09] havenwood: Sabicas: Typically in PHP you use CGI or these days FCGI. So when you request a PHP page, an instance of the PHP interpreter is spun up, renders the page, then dies.
[06:37:45] havenwood: Sabicas: With Rack you're actually running a server. The Rack webserver (like Puma, Unicorn, Passenger, etc) handles requests and parses the HTTP, then Rack middleware does its thing, then the pure Rack app or Rack adapter decides what response to give.
[06:38:27] havenwood: Sabicas: I'd suggest following the links above to create your own simple Ruby CGI (if you'd like) or just skip straight to Rack.
[06:38:55] vondruch: has joined #ruby
[06:39:05] havenwood: Sabicas: https://thoughtbot.com/upcase/videos/rack
[06:39:55] Sabicas: researching those links now
[06:43:21] mtkd: has joined #ruby
[06:44:23] vondruch: has joined #ruby
[06:44:29] havenwood: Sabicas: I really like Roda. I'd suggest giving it a try after making a little Rack app: http://roda.jeremyevans.net/
[06:44:54] cadillac_: has joined #ruby
[06:44:54] havenwood: It's just a routing tree on top of Rack. Then it provides a variety of plugins that you can choose from to compose a framework.
[06:45:16] havenwood: https://github.com/jeremyevans/roda/tree/master/lib/roda/plugins
[06:45:32] jpterry: has joined #ruby
[06:47:15] The_Schmidt: has joined #ruby
[06:48:52] Sabicas: thanks for the advice. Very much appreciated
[06:48:52] vondruch: has joined #ruby
[06:50:08] havenwood: Sabicas: No prob, any time!
[06:53:32] ltem: has joined #ruby
[07:00:33] govg: has joined #ruby
[07:03:12] nacsurte: has joined #ruby
[07:03:26] Sabicas: Any opinions on the Odin Project?
[07:04:22] vondruch: has joined #ruby
[07:07:11] dionysus69: has joined #ruby
[07:08:55] vondruch: has joined #ruby
[07:15:32] jpterry: has joined #ruby
[07:19:40] brent__: has joined #ruby
[07:24:10] _whitelogger: has joined #ruby
[07:26:48] nacsurte: has joined #ruby
[07:29:23] vondruch: has joined #ruby
[07:32:06] marr: has joined #ruby
[07:32:55] claudiuinberlin: has joined #ruby
[07:33:54] vondruch: has joined #ruby
[07:36:01] elcontrastador: has joined #ruby
[07:42:43] Sabicas_: has joined #ruby
[07:44:22] vondruch: has joined #ruby
[07:48:09] Cohedrin_: has joined #ruby
[07:52:11] Silthias1: has joined #ruby
[07:54:42] belmoussaoui_: has joined #ruby
[07:56:04] vondruch: has joined #ruby
[07:56:27] bronson: has joined #ruby
[07:58:40] gr33n7007h: has joined #ruby
[07:58:45] belmoussaoui_: has joined #ruby
[08:01:22] _main_: has joined #ruby
[08:01:32] vondruch: has joined #ruby
[08:02:24] _main_: has joined #ruby
[08:04:22] romain_t: has joined #ruby
[08:08:52] vondruch: has joined #ruby
[08:19:38] mlehrer: has joined #ruby
[08:27:20] cam27: has joined #ruby
[08:29:21] vondruch: has joined #ruby
[08:29:22] FahmeF: has joined #ruby
[08:33:53] vondruch: has joined #ruby
[08:36:33] guille-moe: has joined #ruby
[08:37:51] revolt: has joined #ruby
[08:41:28] ur5us: has joined #ruby
[08:45:41] belmoussaoui: has joined #ruby
[08:50:23] pandaant: has joined #ruby
[08:50:24] oleo: has joined #ruby
[08:55:05] gr33n7007h: has joined #ruby
[08:58:48] jinie: has joined #ruby
[08:59:20] vondruch: has joined #ruby
[09:01:33] AndBobsYourUncle: has joined #ruby
[09:06:25] conta: has joined #ruby
[09:08:54] KeyJoo: has joined #ruby
[09:08:55] vondruch: has joined #ruby
[09:13:45] kies: has joined #ruby
[09:15:30] lxsameer: has joined #ruby
[09:15:34] rfshark: has left #ruby: ()
[09:16:00] LoRez: has joined #ruby
[09:16:27] wlycdgr1: has joined #ruby
[09:17:18] apparition: has joined #ruby
[09:19:37] devyn_: has joined #ruby
[09:32:31] InfinityFye: has joined #ruby
[09:33:15] Jameser: has joined #ruby
[09:34:23] vondruch: has joined #ruby
[09:35:23] ozialien_: has joined #ruby
[09:35:27] brent__: has joined #ruby
[09:38:55] vondruch: has joined #ruby
[09:39:13] Jameser`: has joined #ruby
[09:43:37] Jameser: has joined #ruby
[09:48:41] A124: has joined #ruby
[09:49:24] vondruch: has joined #ruby
[09:53:52] vondruch: has joined #ruby
[09:57:47] bronson: has joined #ruby
[09:58:47] eightlimbed: has joined #ruby
[09:59:09] ashZ: has joined #ruby
[09:59:23] vondruch: has joined #ruby
[09:59:29] eightlimbed: has joined #ruby
[10:05:47] revolt: has joined #ruby
[10:05:47] Silthias1: has left #ruby: ()
[10:06:38] Silthias: has joined #ruby
[10:08:52] vondruch: has joined #ruby
[10:17:13] LoRez: has joined #ruby
[10:25:41] guille-moe: has joined #ruby
[10:26:32] ShalokShalom_: has joined #ruby
[10:29:22] aglorei1: has joined #ruby
[10:33:10] _whitelogger: has joined #ruby
[10:37:44] LoRez: has joined #ruby
[10:43:33] noobineer: has joined #ruby
[10:47:10] zapata: has joined #ruby
[10:47:43] rabajaj: has joined #ruby
[10:48:40] ledestin: has joined #ruby
[10:49:23] vondruch: has joined #ruby
[10:51:49] mostlybadfly: has joined #ruby
[10:53:34] belmoussaoui: has joined #ruby
[10:53:54] vondruch: has joined #ruby
[10:54:07] SCHAPiE: has joined #ruby
[10:56:18] revolt: has joined #ruby
[10:56:49] t-recx: has joined #ruby
[11:04:06] frozengeek: has joined #ruby
[11:07:45] bruce_lee: has joined #ruby
[11:07:45] bruce_lee: has joined #ruby
[11:12:07] guille-moe: has joined #ruby
[11:14:32] revolt: has joined #ruby
[11:16:31] vondruch: has joined #ruby
[11:20:32] alex``: has joined #ruby
[11:21:10] Legion: has joined #ruby
[11:21:15] Legion: has left #ruby: ()
[11:24:44] WeiJunLi: has joined #ruby
[11:27:55] Qommand0r: has joined #ruby
[11:30:30] rfshark: has joined #ruby
[11:34:08] houhoulis: has joined #ruby
[11:36:03] brent__: has joined #ruby
[11:36:41] apparition: has joined #ruby
[11:37:29] guille-moe: has joined #ruby
[11:42:55] jcreixell: has joined #ruby
[11:43:54] vondruch: has joined #ruby
[11:45:12] charliesome: has joined #ruby
[11:45:16] tAn: has joined #ruby
[11:45:23] jcreixell: has joined #ruby
[11:46:06] jcreixell: has left #ruby: ()
[11:46:20] heftig: has joined #ruby
[11:46:59] tcopeland: has joined #ruby
[11:53:32] FahmeF: has joined #ruby
[11:54:23] Silthias: has joined #ruby
[11:56:36] uZiel: has joined #ruby
[11:57:04] Silthias1: has joined #ruby
[11:58:30] rabajaj: has joined #ruby
[11:58:50] bronson: has joined #ruby
[12:01:15] Silthias: has joined #ruby
[12:02:11] Silthias: has joined #ruby
[12:02:53] ltem: has joined #ruby
[12:03:54] rahul_bajaj: has joined #ruby
[12:04:22] vondruch: has joined #ruby
[12:08:55] vondruch: has joined #ruby
[12:10:28] Silthias: has joined #ruby
[12:15:10] _whitelogger: has joined #ruby
[12:18:17] Jameser: has joined #ruby
[12:29:21] vondruch: has joined #ruby
[12:32:42] FahmeF: has joined #ruby
[12:33:18] taurgal: has joined #ruby
[12:36:34] FastJack: has joined #ruby
[12:38:53] vondruch: has joined #ruby
[12:41:39] tcopeland: has joined #ruby
[12:44:24] Nicmavr: has joined #ruby
[12:45:59] ocn: has joined #ruby
[12:46:15] tAn: has joined #ruby
[12:46:31] ocn: has left #ruby: ()
[12:48:46] Jameser: has joined #ruby
[12:52:06] phinxy: has joined #ruby
[12:52:36] sonOfRa: has joined #ruby
[12:53:53] phinxy: has left #ruby: ()
[12:57:38] Kestrel-029: has joined #ruby
[13:01:01] tekacs: has joined #ruby
[13:01:13] rfshark: has joined #ruby
[13:03:21] WeiJunLi: has joined #ruby
[13:04:22] vondruch: has joined #ruby
[13:05:02] Silthias: has joined #ruby
[13:08:54] vondruch: has joined #ruby
[13:11:58] tsia: has joined #ruby
[13:16:28] MrBusiness: has joined #ruby
[13:19:24] vondruch: has joined #ruby
[13:23:55] vondruch: has joined #ruby
[13:24:27] Sembei: has joined #ruby
[13:29:01] GarethAdams: has joined #ruby
[13:34:25] vondruch: has joined #ruby
[13:38:16] naprimer: has joined #ruby
[13:38:54] vondruch: has joined #ruby
[13:44:22] vondruch: has joined #ruby
[13:46:50] tAn: has joined #ruby
[13:48:34] charliesome: has joined #ruby
[13:48:55] vondruch: has joined #ruby
[13:56:27] AxelAlex: has joined #ruby
[13:59:55] bronson: has joined #ruby
[14:07:57] selim: has joined #ruby
[14:11:35] vondruch: has joined #ruby
[14:11:41] guille-moe: has joined #ruby
[14:13:54] vondruch: has joined #ruby
[14:13:58] djuber: has joined #ruby
[14:18:47] conta: has joined #ruby
[14:24:22] vondruch: has joined #ruby
[14:27:47] tsia: has joined #ruby
[14:28:55] vondruch: has joined #ruby
[14:30:38] ShekharReddy: has joined #ruby
[14:33:35] elomatreb: has joined #ruby
[14:39:47] guille-moe: has joined #ruby
[14:45:59] RedNifre: has joined #ruby
[14:46:21] djuber: has joined #ruby
[14:47:08] RedNifre: YNAB stopped working on Linux a while ago so I need a replacement. I couldn't find anything so I wonder about rolling my own. I think a CLI and a database would be enough to get started. How should I go about that?
[14:47:29] RedNifre: I also might want to add network access later.
[14:47:52] RedNifre: ...or maybe sooner, since I might want to write an Android app, too.
[14:48:31] RedNifre: So if I instead create a server with a simple JSON API, I start thinking about Sinatra and Rails.
[14:48:42] tAn: has joined #ruby
[14:48:51] RedNifre: I've used Sinatra before, it's nice and simple, but I heard that Rails is an "all in one" package which also sounds nice.
[14:48:54] RedNifre: What would you recommend?
[14:49:22] RedNifre: To summarize, I want to write some finance budget tracking thing.
[14:52:43] FrostCandy: has joined #ruby
[14:54:22] vondruch: has joined #ruby
[14:54:36] Silthias1: has joined #ruby
[14:56:29] oleo: has joined #ruby
[14:57:39] Silthias: has joined #ruby
[14:58:21] wlycdgr1: has joined #ruby
[15:03:56] vondruch: has joined #ruby
[15:05:30] cam27: has joined #ruby
[15:08:40] kapil___: has joined #ruby
[15:14:23] vondruch: has joined #ruby
[15:18:53] vondruch: has joined #ruby
[15:20:08] k3rn31: has joined #ruby
[15:21:15] dviola: has joined #ruby
[15:25:23] skweek: has joined #ruby
[15:34:36] JusticeFries: has left #ruby: ()
[15:36:29] FahmeF: has joined #ruby
[15:39:09] wlycdgr1: has joined #ruby
[15:41:33] uZiel: has joined #ruby
[15:44:33] taurgal: has joined #ruby
[15:46:34] vondruch: has joined #ruby
[15:48:54] vondruch: has joined #ruby
[15:54:35] milardovich: has joined #ruby
[15:59:20] vondruch: has joined #ruby
[16:00:19] charliesome: has joined #ruby
[16:01:49] bronson: has joined #ruby
[16:03:54] vondruch: has joined #ruby
[16:04:07] teatime: has joined #ruby
[16:04:34] mathys: has joined #ruby
[16:05:18] teatime: Hi. I am new to ruby, but I'm trying to help out a friend (he's taking a programming class) by making him up a little example of solving a certain problem (validating ISBN numbers).
[16:06:08] teatime: I would like to cut some lines out of this if possible, and also avoid "unidiomatic" ruby code: http://dpaste.com//1NJ1WFB
[16:08:03] oleo: has joined #ruby
[16:13:49] _aeris_: has joined #ruby
[16:19:06] jud: has joined #ruby
[16:20:14] clemens3: has joined #ruby
[16:20:49] mkali: has joined #ruby
[16:22:14] goyox86: has joined #ruby
[16:22:30] clemens3: has joined #ruby
[16:23:52] Siyfion: has joined #ruby
[16:23:54] goyox86: has joined #ruby
[16:24:24] vondruch: has joined #ruby
[16:26:47] cconstantine: has joined #ruby
[16:27:12] orbyt_: has joined #ruby
[16:28:19] mtkd: has joined #ruby
[16:28:56] vondruch: has joined #ruby
[16:33:56] milardovich: has joined #ruby
[16:37:59] havenwood: RedNifre: I like Roda for APIs: http://roda.jeremyevans.net/
[16:39:00] havenwood: teatime: Two-space soft tabs are a strong community convention: http://roda.jeremyevans.net/
[16:39:05] havenwood: sorry for the bad link
[16:39:24] havenwood: ?tabs teatime
[16:39:24] ruby[bot]: teatime: Ruby community standards recommend using 2 spaces as indentation (see https://github.com/bbatsov/ruby-style-guide#spaces-indentation and https://ukupat.github.io/tabs-or-spaces/).
[16:39:34] teatime: fair enough
[16:39:42] havenwood: teatime: Line 21 you can use: join.bytes
[16:40:02] havenwood: Line 23 consider using a case statement.
[16:40:28] havenwood: case checkdigit; when '?'; ...; when 'x'; ...; else
[16:41:30] havenwood: Lines 45 and 50 it's preferred to omit explicit `return` on the last line of the method in favor of implicit return.
[16:42:04] MyMind: has joined #ruby
[16:42:09] teatime: what is the best way to fail / indicate failure, if invalid data is passed to .new()
[16:42:33] havenwood: teatime: If it's really an exceptional case when it happens, raise.
[16:43:25] havenwood: teatime: Right now they respond to #valid?, which seems nice.
[16:43:59] havenwood: teatime: If it's not exceptional for one to be instantiated with invalid data, then it makes sense to not raise.
[16:44:07] havenwood: Try to not use raising for flow control.
[16:44:21] vondruch: has joined #ruby
[16:44:26] matthewd: Seems fair to me to raise on something that's syntactically invalid, but be non-#valid? if it's the right shape but the wrong check digit
[16:45:10] teatime: matthewd: interesting, but practically that just means users of the class have to do more error checking more places, maybe
[16:45:14] havenwood: matthewd: good point
[16:46:10] matthewd: teatime: #valid? seems unhelpfully vague if it conflates "you smashed the keyboard" with "that checksum doesn't match"
[16:46:46] teatime: on that topic, you know what else is unhelpfully vague? the standards for ISBN number formatting, lol.
[16:46:53] matthewd: Always raising would work, because it conveys more information than a boolean, but now you have a class whose only job is to raise in initialize
[16:47:31] teatime: maybe should have just made a collection of functions instead of a class; you're right the only real purpose is to validate strings.
[16:48:15] teatime: I thought the class would be a nice way to package up a complicated regex + a bit of extra validation for consumption, but now I dunno
[16:48:54] vondruch: has joined #ruby
[16:49:35] tsia: has joined #ruby
[16:49:41] havenwood: teatime: If you happen to be using Postgres, it does have ISBN and ISBN13 data types.
[16:49:48] xuanrui: has joined #ruby
[16:50:02] havenwood: https://www.postgresql.org/docs/current/static/isn.html
[16:50:20] matthewd: I'm sure there's also a gem, but that's rather undermining the point of the coding exercise, I think ;)
[16:50:40] teatime: which method do y'all prefer for the checkdigit calc, line 25 or lines 37-43 ?
[16:51:00] teatime: I included both on purpose for him to compare
[16:52:27] matthewd: I prefer 25 -- though it should be a method, either way
[16:52:38] yqt: has joined #ruby
[16:54:13] teatime: oh, last question: is there some syntax to let me combine lines 37 and 38
[16:54:19] matthewd: Personally I'd make the initial parse less strict... input.scan(/[0-9X?]/), maybe
[16:54:20] teatime: i = s = 0 # maybe?
[16:54:53] elcontrastador: has joined #ruby
[16:55:34] matthewd: Yes, that'll work, though I'd generally avoid doing it.. particularly given that they're "different zeroes" (?)
[16:56:46] us3r: has joined #ruby
[16:57:12] us3r: hi everyone
[16:57:18] teatime: matthewd, havenwood: thank you
[16:58:33] uZiel: has joined #ruby
[16:58:48] havenwood: teatime: any time
[16:58:51] us3r: I need a good book to learn ruby, I already have experience with other languages, what do you suggest me?
[16:59:03] teatime: us3r: which languages?
[16:59:12] us3r: bash, C and java
[16:59:20] vondruch: has joined #ruby
[16:59:21] Caius: has joined #ruby
[16:59:21] Caius: has joined #ruby
[16:59:28] havenwood: us3r: The Well-Grounded Rubyist, 2nd Edition, is a nice overview. Ruby Under a Microscope is a nice deep dive.
[16:59:43] havenwood: us3r: https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[17:00:24] us3r: thankyouthx
[17:02:36] guille-moe: has joined #ruby
[17:02:59] Caius: has joined #ruby
[17:02:59] Caius: has joined #ruby
[17:03:27] fishcooker: has joined #ruby
[17:03:55] vondruch: has joined #ruby
[17:04:08] Caius: has joined #ruby
[17:04:08] Caius: has joined #ruby
[17:04:23] ixti: has joined #ruby
[17:09:35] Silthias1: has joined #ruby
[17:10:03] conta: has joined #ruby
[17:12:46] nicolai86: has joined #ruby
[17:14:23] vondruch: has joined #ruby
[17:16:18] soahccc: I'm trying to write a little class which basically wraps an array and allows me to #gets on it from another thread. First I would like to know if something is inherently wrong with this and second, what would be the best way to "carry over" the newly added data from line 29 to 75... https://gist.github.com/2called-chaos/23e924c35e4010d6a140863be508741d
[17:18:52] vondruch: has joined #ruby
[17:24:25] vondruch: has joined #ruby
[17:24:44] minimalism: has joined #ruby
[17:30:36] Caius: has joined #ruby
[17:30:36] Caius: has joined #ruby
[17:31:06] jamiejackson: has joined #ruby
[17:33:55] vondruch: has joined #ruby
[17:35:18] phaul: has joined #ruby
[17:36:45] nicolai86: has joined #ruby
[17:39:24] mjolnird: has joined #ruby
[17:39:28] sp4rrow: has joined #ruby
[17:43:03] Caius: has joined #ruby
[17:43:03] Caius: has joined #ruby
[17:45:21] Caius: has joined #ruby
[17:45:21] Caius: has joined #ruby
[17:47:06] __Yiota: has joined #ruby
[17:50:49] tAn: has joined #ruby
[17:53:19] guille-moe: has joined #ruby
[17:56:25] FrostCandy: uh, how do I test if a method is undefiend? Shouldn't this be fine? if fields[required_field.name]
[17:56:35] vondruch: has joined #ruby
[17:58:40] mjolnird: has joined #ruby
[17:58:48] coderphive: has joined #ruby
[17:58:54] vondruch: has joined #ruby
[18:00:07] belmoussaoui: has joined #ruby
[18:01:57] elomatreb: FrostCandy: We'll need a little more detail than that. A basic check if an object has a particular method is #respond_to?
[18:02:40] bronson: has joined #ruby
[18:02:48] FrostCandy: undefined method `name' for #<Array:0x007fec904600d0> thats the error im getting
[18:03:05] milardovich: has joined #ruby
[18:03:17] FrostCandy: basically im checking an object that may or may not hvae the method .name
[18:03:30] belmoussaoui: has joined #ruby
[18:03:44] FrostCandy: defined? may be what i'm looking for.
[18:06:23] RedNifre: has joined #ruby
[18:07:30] rfshark: has left #ruby: ()
[18:08:09] FrostCandy: elomatreb: oh i just realized you pointed me to #respond_to? thanks
[18:08:48] elomatreb: Yes, but it is not 100% reliable in certain situations, e.g. if your object has a badly implemented method_missing interface
[18:09:23] vondruch: has joined #ruby
[18:11:19] opekktar_: has joined #ruby
[18:11:34] sniffer: has joined #ruby
[18:13:54] vondruch: has joined #ruby
[18:15:46] sp4rrow: has joined #ruby
[18:17:00] jinie: has joined #ruby
[18:18:26] kapil___: has joined #ruby
[18:20:18] dcluna: has joined #ruby
[18:20:47] high_fiver: has joined #ruby
[18:22:45] milardovich: has joined #ruby
[18:23:32] anisha: has joined #ruby
[18:24:23] vondruch: has joined #ruby
[18:28:54] vondruch: has joined #ruby
[18:33:01] jackjackdripper: has joined #ruby
[18:35:41] DrCode: has joined #ruby
[18:38:17] DrCode: has joined #ruby
[18:39:03] KeyJoo: has joined #ruby
[18:41:41] jackjackdripper1: has joined #ruby
[18:45:31] cconstantine: has joined #ruby
[18:47:01] nicesignal: has joined #ruby
[18:47:41] cadillac_: has joined #ruby
[18:47:48] claudiuinberlin: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[18:51:36] tAn: has joined #ruby
[18:54:22] vondruch: has joined #ruby
[18:56:22] cconstantine: has joined #ruby
[18:57:44] 18VAB6J9K: has joined #ruby
[19:03:21] Silthias: has joined #ruby
[19:03:56] vondruch: has joined #ruby
[19:04:18] Cohedrin_: has joined #ruby
[19:04:37] Dimik: has joined #ruby
[19:06:55] imode: has joined #ruby
[19:09:24] vondruch: has joined #ruby
[19:09:47] cconstantine: has joined #ruby
[19:13:18] jhass: has joined #ruby
[19:14:20] selim: has joined #ruby
[19:14:22] benlieb: has joined #ruby
[19:16:33] RedNifre: has joined #ruby
[19:16:46] RedNifre: How do I slurp the content of a binary file as a byte array?
[19:17:07] RedNifre: I tried File.read(name, mode: "rb"), but that gives me a String of bytes?
[19:17:15] RedNifre: What does a string of bytes even mean?
[19:18:55] vondruch: has joined #ruby
[19:19:13] RedNifre: Oh, I see... there's no actual byte datatype, huh?
[19:20:39] zautomata: has joined #ruby
[19:21:14] jhass: has joined #ruby
[19:22:36] cconstantine: has joined #ruby
[19:27:58] bronson: has joined #ruby
[19:37:58] tcopeland: has joined #ruby
[19:39:53] marr: has joined #ruby
[19:48:33] VladGh: has joined #ruby
[19:52:38] tAn: has joined #ruby
[19:55:18] guille-moe: has joined #ruby
[19:55:44] charliesome: has joined #ruby
[20:02:17] 7JTACAJ0B: has joined #ruby
[20:04:08] belmoussaoui_: has joined #ruby
[20:07:14] Silthias: has joined #ruby
[20:07:31] AndBobsYourUncle: has joined #ruby
[20:12:26] astronavt: has joined #ruby
[20:12:56] elcontrastador: has joined #ruby
[20:14:05] claudiuinberlin: has joined #ruby
[20:14:22] vondruch: has joined #ruby
[20:15:33] jpterry: has joined #ruby
[20:18:52] vondruch: has joined #ruby
[20:20:54] belmoussaoui: has joined #ruby
[20:22:10] Silthias1: has joined #ruby
[20:22:15] jdbrowne: has joined #ruby
[20:22:19] milardovich: has joined #ruby
[20:23:08] belmoussaoui: has joined #ruby
[20:24:24] vondruch: has joined #ruby
[20:24:55] Azure: has joined #ruby
[20:25:37] cout: RedNifre: a byte data type wouldn't make sense in ruby due to the way it manages memory; all values (either immediate values or object references) are the same size as the platform's pointer type
[20:26:14] RedNifre: thanks, I guess I'll work with int arrays.
[20:26:49] romulus10: has joined #ruby
[20:28:25] enterprisey: has joined #ruby
[20:29:55] cout: RedNifre: what is it you are trying to do? You might find NArray useful.
[20:32:06] goyox86_: has joined #ruby
[20:33:52] vondruch: has joined #ruby
[20:33:53] RedNifre: cout there's an ancient binary format for patching other binary files. There exist many implementations but I want to create one for ruby practice.
[20:34:09] RedNifre: Also, I don't want to install proprietary windows exe files on my linux if the format is that simple.
[20:35:00] RedNifre: The format consists of records that go [3 bytes, 2 bytes, some bytes]* where the first 3 bytes specify the position in the target file, the next two specify how many bytes "some bytes" are.
[20:35:27] RedNifre: I'm not aiming for efficiency, I'm aiming for readable source code.
[20:35:48] matthewd: String is the bytearray type. String#unpack is likely to be helpful.
[20:37:14] RedNifre: Yeah, I already unpacked them as C*
[20:37:51] RedNifre: How to I write an array somewhere into another array?
[20:38:37] RedNifre: something like [1, 2, 3, 4].put_at(1, ["a", "b"]) => [1, "a", "b", 4]
[20:39:16] matthewd: ary[1, 2] = ["a", "b"]
[20:39:21] RedNifre: also, I need [1,2,3].put_at(2, ["a", "b", "c"] => [1, 2, "a", "b", "c"]
[20:39:30] RedNifre: ah, of course!
[20:39:45] KeyJoo: has joined #ruby
[20:40:27] workmad3: has joined #ruby
[20:40:29] matthewd: (but I really don't see why you wouldn't keep it as a string)
[20:41:02] RedNifre: well, I have to pull 3 bytes from it and interpret as an int.
[20:41:32] RedNifre: I currently do that as size = (a[0] << 16) + (a[1] << 8) + a[2]
[20:41:56] ur5us: has joined #ruby
[20:43:25] Silthias: has joined #ruby
[20:44:22] vondruch: has joined #ruby
[20:47:16] quobo: has joined #ruby
[20:48:56] vondruch: has joined #ruby
[20:53:16] wlycdgr1: has joined #ruby
[20:54:24] vondruch: has joined #ruby
[20:57:11] tAn: has joined #ruby
[20:57:51] apeiros: RedNifre: why don't you use a String? they are byte arrays. just make sure to use binary encoding.
[20:58:08] apeiros: also they are *much* more compact than integer arrays.
[20:58:19] RedNifre: Okay, I'll see if I can change it.
[20:58:54] RedNifre: Well, I'm nearly done so I first check if it actually works before I rewrite everything.
[20:59:31] RedNifre: Ehm, how do I write an array of integers to a file interpreting the integers as single bytes?
[21:00:33] milardovich: has joined #ruby
[21:00:42] RedNifre: Ah, guess I'll do String::unpack
[21:01:09] apeiros: that's the wrong way round ;-)
[21:01:16] apeiros: you have an array, you want a string -> Array#pack
[21:01:53] donnie: has joined #ruby
[21:01:55] RedNifre: Yeah, that's what I meant :)
[21:02:07] apeiros: also :: means class method. use # to denote instance methods
[21:03:56] vondruch: has joined #ruby
[21:06:01] donnie: has joined #ruby
[21:06:09] __Yiota: has joined #ruby
[21:07:35] KeyJoo: has joined #ruby
[21:07:51] apeiros: RedNifre: re size requirements: an empty array, an array of ints up to 3 elements, an empty string, and a string with up to 23 bytes are all 40 bytes. an array with >3 elements is 40 bytes + size * 8 bytes. a string with > 23 bytes is 41 bytes + size * 1 byte
[21:08:02] apeiros: (ruby 2.4)
[21:08:52] apeiros: so 100 bytes of data as int array is 840 bytes, and as string 141 bytes. it's asymptotically 8x larger.
[21:09:33] RedNifre: Okay, given that my computer has some GB of RAM and I'm patching files that are 200kB large it's all fine. But I'll look into it.
[21:10:05] apeiros: sure. depending what you do, choosing an int array may still be the better choice.
[21:11:01] planigan: has joined #ruby
[21:12:24] comet23: has joined #ruby
[21:13:09] milardovich: has joined #ruby
[21:14:03] elsevero: has joined #ruby
[21:14:21] vondruch: has joined #ruby
[21:14:33] RedNifre: If you have a minute I see if I can put it on github.
[21:15:31] cajone: has joined #ruby
[21:15:40] mark_on_the_moon: has joined #ruby
[21:18:54] vondruch: has joined #ruby
[21:24:21] vondruch: has joined #ruby
[21:26:34] RedNifre: apeiros I currently don't have the time to set up the repo properly but here's a paste: https://gist.github.com/anonymous/00795f4fa3e7750d663b031875d28616
[21:27:58] Cohedrin_: has joined #ruby
[21:32:56] apeiros: > class IpsRecord < Struct.new # don't do that. do IpsRecord = Struct.new(…), you can use do/end block if you have a class body.
[21:33:15] apeiros: you're not yet used to classes?
[21:33:56] vondruch: has joined #ruby
[21:34:30] matthewd: apeiros: Discouraging inherit-from-struct seems likely to lead to confusion, IMO
[21:35:08] matthewd: You can't override+super in initialize
[21:35:09] AndBobsYourUncle: has joined #ruby
[21:35:59] apeiros: seems expected to me
[21:36:19] matthewd: (plus the fact it potentially takes people on a block-heavy journey when they're maybe better off sticking with a more rigid class == `class` starting point)
[21:37:06] apeiros: well, re the latter - people are also confused when they see `< not_a_plain_constant`. so that part is a stand-off IMO between different kinds of confusion :)
[21:37:09] RedNifre: apeiros Right, I'm very new to serious ruby.
[21:37:09] MrBusiness: has joined #ruby
[21:37:22] matthewd: Expected given a base understanding, sure... but it's still a PITA to get from using the default to "oh and I just want to give this one other ivar an initial value"
[21:37:25] apeiros: RedNifre: might be a good case to start experimenting with classes.
[21:37:50] apeiros: matthewd: IMO at that point, stop using a struct and just use a normal class.
[21:38:14] apeiros: structs are for small struct-y stuff. classes for everything beyond. just my 2c.
[21:38:16] RedNifre: But with a normal class I would have to define a constructor. Isn't Struct exactly right in my case?
[21:38:18] matthewd: Using `Class.new do`? 😏
[21:38:47] apeiros: RedNifre: sorry, I didn't explain clearly. I'm referring to your whole code. IpsRecord is perfectly fine otherwise.
[21:38:54] apeiros: matthewd: of course.
[21:39:03] RedNifre: What else about the code?
[21:39:15] RedNifre: I'll see if I can rewrite it to use strings instead of int arrays tomorrow. Anything else?
[21:39:19] bronson: has joined #ruby
[21:39:22] apeiros: RedNifre: got caught up in this little chat. I'm looking at it ;-)
[21:39:38] apeiros: also got something small to do IRL
[21:40:03] RedNifre: I'm implementing this format in the dumbest simplest way possible: https://zerosoft.zophar.net/ips.php
[21:40:27] RedNifre: e.g. that format has a run length encoding in some places which I expand at the earliest possible moment, wasting "lots" of RAM.
[21:41:01] apeiros: your code seems to look mostly fine otherwise. I don't like the long if/else assignment in L16-23, though.
[21:41:40] matthewd: I guess it depends on your definitions of dumbest/simplest.. if you mean 'the first thing that comes to mind', then I can't argue with that
[21:41:48] RedNifre: yeaYeah, that one also has the weird side effect of setting raw_bytes
[21:42:11] matthewd: But this seems more convoluted than I expect, given my loose understanding of what it does
[21:42:18] RedNifre: matthewd please note that I'm just beginning to use ruby seriously, so it's probably not straight forward at all.
[21:43:45] RedNifre: matthewd Could you check out this "finished" script? It's something that I personally think looks good: https://github.com/RedNifre/pi_assistant_garbage/blob/master/garbage.rb
[21:43:56] matthewd: Right; noted. I'm just feeling mixed signals because you're responding to feedback on how to simplify the code with ~ "yeah I know it's not efficient, I'm just doing it the simplest way"
[21:44:36] runescape07rsps: has joined #ruby
[21:44:39] RedNifre: matthewd sorry, I meant that expanding RLE encoded data early is "simple", not that converting a byte string to int array and back is simple.
[21:44:56] RedNifre: But maybe I'll should continue working on it a bit more before I'll ask for more feedback.
[21:45:45] RedNifre: But would you say that the garbage.rb looks unconditionally fine? https://github.com/RedNifre/pi_assistant_garbage/blob/master/garbage.rb
[21:46:10] matthewd: That one's the obvious example, just because I'm pretty sure you can get from array-of-ints back to just-strings purely via deletions
[21:46:25] tomyncy618: has joined #ruby
[21:47:38] balazs_: has joined #ruby
[21:47:45] wlycdgr1: has joined #ruby
[21:48:18] apeiros: YAML.load File.read( -> YAML.load_file
[21:48:21] matthewd: Not unconditionally, no... but that again comes back to what form of feedback you want
[21:48:46] matthewd: I think most feedback I'd give there would feel more like fussing over details
[21:50:21] RedNifre: apeiros thanks, fixed
[21:50:23] matthewd: e.g. formatting issues... and I don't like the apparent instance_eval in the gpio library (though maybe that's out of scope)
[21:50:36] elomatreb: Those explicit + in lines 17 and 18 definitely look weird
[21:50:51] RedNifre: matthewd I don't even know what kind of feedback I want. Anything that would help.
[21:51:06] matthewd: For something of this size, sticking with a hash-based data structure isn't terrible... but in a larger app, I'd push for some Actual Classes instead
[21:51:16] RedNifre: elomatreb those signal the direction of the current. For inputs like buttons you would write the pin number with a minus in front of it.
[21:51:21] RedNifre: + is output, - is input
[21:51:59] elomatreb: Did they actually use the unary + method? First time seeing that in the wild
[21:52:05] RedNifre: matthewd yes, having actual gpio pin objects would be better for larger projects but the point of the easygpio thing is to make using raspberry pi pins as easy as possible
[21:52:33] matthewd: I'm talking about classes for the 'garbage' stuff
[21:53:03] matthewd: (though that too)
[21:53:21] RedNifre: so in the beginning of the file you assign names to the pins you want to use, specifying the direction with plus or minus and run your code in the block. the gpio method takes care of activating the pins and even has an ensure clause in case the block crashes.
[21:53:32] RedNifre: classes for the "garbage" stuff?
[21:54:02] RedNifre: Wouldn't that be overkill if the garbage data is just a calendar and a number?
[21:54:26] matthewd: Again, my objection to the gpio bit isn't the fact it provides an abstraction layer -- of course that's a good thing -- it's the detail of how it does it via instance_eval
[21:54:51] matthewd: I'd prefer 22 to be `x.led_paper = capacity_left?(..)`, say
[21:55:00] elomatreb: Depending on how you look at it using Ruby already is overkill, so you might as well go all the way and do proper classes
[21:55:06] matthewd: (where `x` is a block argument from 19)
[21:55:42] RedNifre: It was a block argument originally but I thought it looked neater with instance_eval.
[21:55:52] RedNifre: Of course that might be subjective or wrong
[21:56:48] RedNifre: I already thought about how a more serious approach would look like: Specify the pins for all programs in a separate yaml and then just do gpio("red_led", "button") do { |pins| pins.red_led.on() }
[21:57:09] RedNifre: That would be more explicit and flexible but it would also increase the perceived complexity.
[21:57:33] RedNifre: The instance_eval approach is more DSL-like: Declare at the start what you want, then just use it magically.
[21:58:05] matthewd: Yet again, I'm objecting to the instance_eval, not the fact you're defining the pin assignments here
[21:58:09] elomatreb: The problem with instance_eval interfaces is that you can't use your own methods inside the block you give
[21:58:39] RedNifre: I don't understand. What do you mean by you can't use your own methods inside the block?
[21:59:21] vondruch: has joined #ruby
[21:59:30] elomatreb: It would try to call them on the object you're evaling on. I.e. you def a helper method you want to use above the block, but it won't work inside an instance_eval block
[21:59:38] matthewd: RedNifre: Which methods are getting called on your gpio object, in this script?
[22:00:12] matthewd: I'll start you off: led_paper
[22:00:16] RedNifre: matthewd only led_paper and led_recycling, as specified in the parameters of gpio.
[22:00:34] matthewd: There are another four
[22:00:50] RedNifre: my world is crumbling!
[22:00:53] matthewd: Sorry, another three beyond those two
[22:01:00] goyox86_: has joined #ruby
[22:01:27] RedNifre: which ones? Do you mean loop and sleep?
[22:01:40] matthewd: Yes. loop, sleep, and capacity_left?
[22:01:53] matthewd: All called on the Gpio instance, because of the instance_eval
[22:02:28] RedNifre: Okay, but those hit missing methods and eventually find the capacity_left? method, so what is the problem? (Not being snarky, I honestly don't know what the problem is)
[22:03:32] matthewd: Well, there's the fact it breaks encapsulation: you're inside the object, so you can call its private methods
[22:03:50] apeiros: sorry, I thought those RL things would be done quicker. got to go. but you're in good hands with matthewd :)
[22:03:54] vondruch: has joined #ruby
[22:04:24] matthewd: But mostly it just creates confusion because it's not obvious in the calling code that the evaluation context is being swapped out from underneath
[22:04:27] RedNifre: thanks apeiros :)
[22:04:40] matthewd: And just to avoid typing `x.` twice
[22:07:32] RedNifre: Well, it's two different philosophies I guess. You can create a clean, flexible interface that scales or a magical one that has a lot of implicit stuff in the background.
[22:08:54] RedNifre: To clarify, I personally think that it's fine for the garbage.rb case, but it becomes weird in the morse code case where I pass a method reference in line 46 here: https://github.com/RedNifre/pi_assistant_garbage/blob/master/morse.rb
[22:09:33] RedNifre: There's some extra morse code stuff that needs to know where to output the morse code. Ideally I would pass a pin object, but since those aren't exposed right now I have to parse the method reference.
[22:10:13] RedNifre: I still believe that the magical approach has value though. It keeps the simple things simple (but complicates the less simple things)
[22:11:05] RedNifre: Anyway, thanks for your input, I have to leave now but I'll try to fix the issues tomorrow.
[22:11:09] RedNifre: Good night and thanks!
[22:12:03] aleandros: has joined #ruby
[22:14:22] vondruch: has joined #ruby
[22:19:59] tcopeland: has joined #ruby
[22:22:42] AxelAlex: has joined #ruby
[22:23:55] vondruch: has joined #ruby
[22:24:46] ledestin: has joined #ruby
[22:25:27] AxelAlex: has joined #ruby
[22:26:03] benlieb: has joined #ruby
[22:30:02] Mia: has joined #ruby
[22:30:03] Mia: has joined #ruby
[22:35:55] enterprisey: has joined #ruby
[22:39:48] bronson: has joined #ruby
[22:42:16] wlycdgr1: has joined #ruby
[22:44:24] vondruch: has joined #ruby
[22:48:53] vondruch: has joined #ruby
[22:49:21] wlycdgr1: has joined #ruby
[22:50:32] astronavt: has joined #ruby
[22:51:18] belmoussaoui__: has joined #ruby
[22:53:31] astronavt: i'm a little confused about Bundler. when i run `bundle install`, it installs to my system-wide gem directory
[22:55:42] Salmonidae: that's the default behaviour, you can use --path for a local bundle that doesn't reside with your system gems. why, well, because it's more likely you'll re-use those gems as you go between different projects with their own bundles. Gemfile.lock is what ensures dependency resolution.
[22:56:11] astronavt: interesting
[22:56:22] astronavt: coming from python i was expecting virtualenv-like behavior by default
[22:56:39] Salmonidae: more npm-like, or cargo-like (Rust).
[22:57:06] astronavt: so if i wanted true encapsulation i'd use 'bundle exec --path vendor/bundle' or something?
[22:57:15] astronavt: ok thank you
[22:57:30] Salmonidae: bundle install --path vendor/bundle
[22:57:38] Salmonidae: bundle install --help
[22:57:55] astronavt: or vendor/cache rather
[22:58:17] Salmonidae: sure, where ever. i actually use --path .vendored
[22:58:28] houhoulis: has joined #ruby
[22:58:30] astronavt: i was actually reading the docs for 'bundle package' by accident
[22:59:01] astronavt: this is a good tool
[22:59:16] astronavt: fast, nicely laid out CLI
[22:59:22] vondruch: has joined #ruby
[22:59:22] astronavt: documentation could be better though ;)
[22:59:51] astronavt: way better than Pip
[22:59:56] astronavt: Gem + Bundler together i mean
[23:00:20] Salmonidae: ruby is way better than python too, so it's your lucky day 😎
[23:00:50] astronavt: i'm a data scientist so until you give me a giant machine learning and text processing ecosystem i'm stuck
[23:01:28] astronavt: what's ruby's C interface like? any reason someone couldn't port numpy to ruby?
[23:01:42] Salmonidae: not familiar with that space at all. the C interface seems good. it's easy. simple.
[23:02:39] astronavt: so if i dont do "bundle install --path" is there any reason to use "bundle exec"?
[23:03:14] Salmonidae: this is probably the most annoying and confusing thing about bundler
[23:03:37] Salmonidae: let me explain
[23:03:56] vondruch: has joined #ruby
[23:05:26] Salmonidae: when you do 'bundle install --path vendored/foo' bin' scripts belonging to gems are not on your $PATH. so 'rspec' does not exist. bundle exec rspec is required to find it. now in case of system gems/bundle, 'rspec' will exist but it won't use your bundle!
[23:05:59] Salmonidae: dependency resolution will not be pinned to Gemfile.lock in case of bare 'rspec'
[23:06:42] Salmonidae: the work around, is to always require "bundler/setup" in your spec suite (for example). this ensures that if 'bundle exec' is not used, after the require of 'bundler/setup' all subsequent requires will be pinned to Gemfile.lock
[23:09:23] vondruch: has joined #ruby
[23:09:30] astronavt: w/ similar motivation for "binstubs" right?
[23:09:51] Salmonidae: yeah. i haven't used them. my approach to this problem is to use require "bundler/setup".
[23:10:56] cconstantine: has joined #ruby
[23:12:44] nopolitica: has joined #ruby
[23:14:01] alveric2: has joined #ruby
[23:18:55] vondruch: has joined #ruby
[23:18:56] AxelAlex: has joined #ruby
[23:24:20] vondruch: has joined #ruby
[23:24:21] enterprisey: has joined #ruby
[23:27:12] lexruee: has joined #ruby
[23:28:55] vondruch: has joined #ruby
[23:31:41] newbie57: has joined #ruby
[23:35:26] astronavt: can i change ~/.bundle/cache to something more reasonable like $XDG_CACHE_HOME/bundle ?
[23:35:42] astronavt: i could always symlink it, but i just hate having stuff lying around in ~
[23:38:22] Salmonidae: https://github.com/bundler/bundler/issues/4333
[23:38:37] brent__: has joined #ruby
[23:38:40] Silthias1: has joined #ruby
[23:39:18] Salmonidae: a lot of rubyists are mac users and don't linux good.
[23:39:23] vondruch: has joined #ruby
[23:39:52] Radar: Yeah we don't really do the regular linux things like recompiling our kernels from scratch whenever our GPU vendor releases an update
[23:40:05] Radar: And audio works 100% of the time on Mac
[23:41:10] Salmonidae: it's not what i mean. software is usually optimal for the platform it is developed on, and in a lot of cases it's mac for ruby
[23:41:31] Radar: Works On My Machine™
[23:41:40] Radar: Patches Welcome™®
[23:42:30] Radar: "plz support my platform" "but this is OSS, just contribute a patch back" "lol no u r maintainer, you patch plz" "but that is my free time that I would be spending supporting _your_ platform"
[23:42:31] fishcooker: has joined #ruby
[23:42:35] Radar: and on and on it goes
[23:42:48] Radar: You want life to be better? Patch it.
[23:43:12] Salmonidae: it depends how you look at it. i look at it that software should be optimal for all platforms, if it's some major ruby lib
[23:43:53] vondruch: has joined #ruby
[23:44:11] Radar: I don't own a modern Windows system. If someone contacted me about a Windows support issue on one of my libraries I probably couldn't help them very well because I would struggle to reproduce the issue.
[23:44:29] Salmonidae: i use VMs for this problem
[23:44:33] Radar: Buying a Windows machine is within my capabilities, but then I need to set it up, install Ruby, replicate the bug... that's a good weekend project if I had nothing else on that weekend.
[23:44:49] jenrzzz: has joined #ruby
[23:44:49] jenrzzz: has joined #ruby
[23:44:51] Radar: I'd still need to buy Windows and set it up. That's at least 2 hours.
[23:45:03] Radar: Or I could spend that 2hrs triaging other issues?
[23:45:11] Salmonidae: sure. since when is open source not effort?
[23:45:24] Salmonidae: well that's up to you
[23:45:32] Radar: An OSS maintainer isn't your slave. If you want better support on a particular platform for a particular project then contribute back.
[23:45:50] Radar: Open source effort shouldn't just be the maintainer doing the effort.
[23:45:55] Radar: That's what leads to classical burnout.
[23:46:02] Salmonidae: i agree. but i also think it's something for the project to prioristise too.
[23:46:10] Radar: "plz add this feature" "I don't care about it" "omg u suck" <- classic OSS conversation
[23:46:37] astronavt: Salmonidae actually i'm a mac user
[23:46:46] astronavt: i have $XDG_DATA_HOME=$HOME/Library
[23:46:51] Radar: I agree that it would be something to prioritise, but only if it affected a large swath of users.
[23:46:54] astronavt: $XDG_CACHE_HOME=$HOME/Library/Caches
[23:47:22] Salmonidae: ah. but XDG is a linux standard as far as i know. it's non-standard on OSX, and it has its own equivalents.
[23:47:41] astronavt: either way, $HOME/.bundle is wrong ;)
[23:47:52] Salmonidae: yeah should be configurable somehow
[23:48:00] Radar: https://github.com/bundler/bundler/pull/5787#issuecomment-311745316
[23:48:15] Radar: indirect says: "I'm open to the possibility of allowing the user_bundle_path to be configured"
[23:48:18] astronavt: i feel like there ought to be an "official/unofficial" XDG mapping to Linux and Windows... and a compat library in every major programming language
[23:48:26] Salmonidae: that's very presumptious on his part
[23:48:33] Salmonidae: because i see XDG requests all the time
[23:48:42] cconstantine: has joined #ruby
[23:48:58] Salmonidae: and linux "programs" (C style) definitely respect it
[23:49:08] astronavt: tbh i'm surprised you can't just "gem install xdg" and have the problem solved
[23:49:37] astronavt: or have it set through environment variables
[23:50:15] astronavt: BUNDLER_HOME=$HOME/.bundler maybe? idk, hate to be presumptuous about this kind of thing without seeing the code
[23:50:26] Salmonidae: sure. that could work
[23:50:27] astronavt: maybe ~/.bundler is hardcoded everywhere and it'd take a whole afternoon to fix
[23:51:54] doublemalt__: has joined #ruby
[23:52:36] Salmonidae: it sounds like the complexity of it being configurable isn't worth it
[23:52:48] Salmonidae: and no one really cares.
[23:52:52] Salmonidae: more or less
[23:53:23] Salmonidae: time better spent on other things
[23:53:32] Salmonidae: but if someone else did a PR im sure they'd review it
[23:57:19] Salmonidae: `gem install xdg` seems like a good idea too
[23:59:21] vondruch: has joined #ruby