« Back to channel list

#ruby - 30 January 2019

« Back 1 day Forward 1 day »
[00:01:48] baweaver: For a small application it probably won't kill you.
[00:02:02] baweaver: For a larger one, a Hash is going to be a nightmare down the road
[00:02:39] baweaver: Primarily around documentation, interface contracts, deprecations, and other such things. A class would be used when you need structure, and structure that you can communicate
[00:03:35] baweaver: Sure, one can use `keys` on a hash, but how do you know what the intent of each of those keys is? If it's just a few, it's probably not a big deal, but as it grows it's easy to lose track of them.
[00:04:13] baweaver: Though it's a notably good idea to question standard practice once in a while, as some things are just cargo culted from days and languages long past
[00:04:43] baweaver: Visceral reactions to questions should force an amount of introspection as to _why_ we make certain decisions
[00:06:16] baweaver: A few other fun topics which start that type of fire real quick: goto, global variables, shorthand globals, english operators, etc etc
[00:06:44] baweaver: That said, it'd be impolite to drop those types of grenades without yourself doing some sort of pre-reading on the topic
[00:07:14] baweaver: Even moreso to assume that the lack of response or improper level of it confirms that they're not a big deal
[00:07:51] baweaver: ACTION wrote a small blog post again
[00:09:27] phaul: I can't help but wonder if you meant my response by your last remark. I'm happy to go on with a debate as I stand by my views. I don't really see what was improper about them
[00:11:35] phaul: I would say we don't know if an encapsulated Hash that you delegate to is or is not the right internal representation, that would depend on whats stored there, and usage patterns. If you can get away with a bunch of instance vars instead ofc you should do that
[00:13:28] planigan_: has joined #ruby
[00:14:23] phaul: but I agree with all your points that you made on having a class & dedicated interface
[00:15:31] themsay: has joined #ruby
[00:30:45] themsay: has joined #ruby
[00:35:43] AJA4350: has joined #ruby
[00:38:18] mat_bug: has joined #ruby
[00:39:40] baweaver: phaul: Wasn't meant as an indictment
[00:39:41] baweaver: Just as an "It's ok to ask questions"
[00:39:58] duderonomy: has joined #ruby
[00:40:00] baweaver: I wouldn't characterize any responses here as visceral by any measure
[00:40:10] baweaver: But I have certainly seen them in the past.
[00:53:00] sonofentropy: has joined #ruby
[00:58:33] AJA4351: has joined #ruby
[01:04:53] W33DS: has joined #ruby
[01:25:24] AJA4350: has joined #ruby
[01:35:18] tris: has joined #ruby
[01:42:42] code_zombie_: has joined #ruby
[01:46:12] tdy: has joined #ruby
[01:46:22] ansraliant: has joined #ruby
[01:47:51] AJA4351: has joined #ruby
[02:12:09] Cthulu201: has joined #ruby
[02:13:01] houhoulis: has joined #ruby
[02:14:12] haxx0r: has joined #ruby
[02:18:11] _whitelogger: has joined #ruby
[02:26:24] mat_bug: has joined #ruby
[02:37:06] esrse: has joined #ruby
[02:40:19] limezzz: has joined #ruby
[02:40:23] tdy: has joined #ruby
[02:54:35] brandoncc: has joined #ruby
[03:00:37] mat_bug: has joined #ruby
[03:05:23] maryo_: has joined #ruby
[03:06:03] tdy: has joined #ruby
[03:10:19] orbyt_: has joined #ruby
[03:11:06] cnsvc: has joined #ruby
[03:22:23] znz_jp: has joined #ruby
[03:30:01] DTZUZO: has joined #ruby
[03:30:33] foobear: has joined #ruby
[03:34:18] foobear: has left #ruby: ()
[03:41:34] duderonomy: has joined #ruby
[04:09:02] braincrash: has joined #ruby
[04:28:11] sonofentropy: has joined #ruby
[04:36:40] tdy: has joined #ruby
[04:50:17] mat_bug: has joined #ruby
[05:16:47] cnsvc: has joined #ruby
[05:21:18] orbyt_: has joined #ruby
[05:28:45] jcarl43: has joined #ruby
[05:31:12] meinside: has joined #ruby
[05:41:12] dviola: has joined #ruby
[05:45:44] dellavg_: has joined #ruby
[05:47:23] mat_bug: has joined #ruby
[05:49:41] akem: has joined #ruby
[05:50:06] tdy: has joined #ruby
[05:50:08] govg: has joined #ruby
[05:53:03] tdy: has joined #ruby
[06:02:00] Leifr: has joined #ruby
[06:07:28] Milos: has joined #ruby
[06:08:06] ravenousmoose: has joined #ruby
[06:08:53] dinfuehr: has joined #ruby
[06:10:00] mat_bug: has joined #ruby
[06:19:38] orbyt_: has joined #ruby
[06:21:44] conta: has joined #ruby
[06:33:29] kapil____: has joined #ruby
[06:54:12] GinoMan: has joined #ruby
[07:00:07] mat_bug: has joined #ruby
[07:05:12] ramfjord: has joined #ruby
[07:05:28] Nicmavr: has joined #ruby
[07:06:42] \void: has joined #ruby
[07:08:28] dinfuehr: has joined #ruby
[07:09:00] aupadhye: has joined #ruby
[07:10:52] govg: has joined #ruby
[07:11:34] blackmesa1: has joined #ruby
[07:26:59] dinfuehr: has joined #ruby
[07:39:56] clemens3: has joined #ruby
[07:40:10] snuz: has joined #ruby
[07:45:38] mat_bug: has joined #ruby
[07:50:24] nfk: has joined #ruby
[08:05:14] clemens3: has joined #ruby
[08:15:47] nowhere_man: has joined #ruby
[08:16:29] coderphive: has joined #ruby
[08:25:28] bruce_lee: has joined #ruby
[08:26:21] sonofentropy: has joined #ruby
[08:36:44] akemot: has joined #ruby
[08:38:04] mikecmpbll: has joined #ruby
[08:44:38] akemot: has joined #ruby
[09:03:53] ellcs: has joined #ruby
[09:04:20] jammanbo: has joined #ruby
[09:13:56] ntt: Hello, how can I pass a variable to the match() method? example: str="/myregex$/"; x.match(str)
[09:14:06] ntt: obviously my example doesn't work
[09:16:13] mikecmpbll: has joined #ruby
[09:17:55] TheBrayn: match can be used on a regexp https://ruby-doc.org/core-2.6/Regexp.html#method-i-match or on a string https://ruby-doc.org/core-2.6/String.html#method-i-match
[09:19:15] ntt: x is a string in my case
[09:19:41] ntt: and str should be the regex.... probably the name of the variable is not so good
[09:20:53] TheBrayn: don't quote your regexp
[09:20:58] TheBrayn: just do /myregexp$/
[09:21:02] leftylink: &>> ["a".match(/a$/), "a".match("a$"), "will_never_match_a".match("/a$/"), "could_m/a/tch".match("/a/")]
[09:21:03] rubydoc: # => [#<MatchData "a">, #<MatchData "a">, nil, #<MatchData "/a/">] (https://carc.in/#/r/64j6)
[09:22:36] ntt: I need to use a variable to save the regex because the regex is variable
[09:24:08] ellcs: isn't the second solution from ntt the thing you are looking for? :)
[09:25:18] TheBrayn: ntt: do you know how variables in ruby work?
[09:26:14] ravenousmoose: has joined #ruby
[09:26:22] jammanbo: It sounds like ntt wants to dynamically construct their regex, right?
[09:27:06] jammanbo: You can interpolate in Regexs, which may or may not be sufficient.
[09:27:19] jammanbo: e.g. /aaa#{my_var}bbb/
[09:27:37] jammanbo: There are obvious potential issues with that though
[09:28:19] ntt: ok. so I can do rx="a" and then x.match(/#{a}/)
[09:29:42] ntt: yes. it works
[09:29:44] ntt: thank you
[09:29:51] jammanbo: Also, is there any chance that you are just trying to see if a string ends with another, variable and possibly user supplied, string?
[09:30:15] jammanbo: cos we have the technoology for taht
[09:31:33] jammanbo: Em, can anyone recommend a brilliant XML to Hash/JSON converter? XML is coming from Savon and its/Nori's #to_hash is nearly great, except for it's inconsistent handling of attributes.
[09:32:32] ntt: jammanbo: here is the complete line in my code: myarray.select{|x| x.match(/#{rx}$/)}
[09:33:01] ntt: so basically I'm trying to see if a string ends with another, because each element of the array is a string
[09:33:55] jammanbo: ntt: Will x.end_with?(rx) suffice, or is rx actually a regex (as opposed to a simple string)
[09:34:14] ramfjord: has joined #ruby
[09:34:45] ntt: no. rx is just a simple string
[09:36:00] jammanbo: You can just use https://ruby-doc.org/core-2.2.3/String.html#method-i-end_with-3F so
[09:38:09] BH23: has joined #ruby
[09:39:13] ramfjord: has joined #ruby
[09:41:03] BLuEGoD: has joined #ruby
[09:41:07] apparition: has joined #ruby
[09:46:11] BH23: has joined #ruby
[09:54:15] pbandark: has joined #ruby
[09:57:00] ntt: jammanbo: thank you
[10:00:29] jammanbo: You are welcome ntt
[10:01:16] dhollin3: has joined #ruby
[10:15:03] keanny479: has joined #ruby
[10:16:00] keanny479: Hi, im learning Ruby, is there a way to rewrite these instance variables ? => https://gist.github.com/wesley974/515ff5488111c60078d0f49fa9ed662d
[10:17:54] tbuehlmann: keanny479: hey! what exactly do you mean, to "rewrite" the instance variables?
[10:19:58] keanny479: avoid 3 lines to declare these instance variables, they share the same source local variable
[10:20:09] keanny479: i just ask if there's a way for a rewrite
[10:22:55] tuor: has joined #ruby
[10:23:32] tbuehlmann: nah, that's fine
[10:24:09] tankf33der: has left #ruby: ()
[10:25:11] keanny479: Thank's tbuehlmann
[10:33:19] ramfjord: has joined #ruby
[10:34:21] keanny479: Is there a way to rewrite the replace method ? => https://gist.github.com/wesley974/515ff5488111c60078d0f49fa9ed662d
[10:36:18] keanny479: or perhaps there's a gem that already do keyword replacement in file... ?
[10:40:15] Guest16678: has joined #ruby
[10:41:40] Emmanuel_Chanel: has joined #ruby
[10:45:31] nfk: has joined #ruby
[10:51:02] leftylink: well, if you have https://en.wikipedia.org/wiki/Sed installed, you could consider using it
[10:52:38] akemot: has joined #ruby
[11:01:36] blackmesa1: has joined #ruby
[11:14:45] ramfjord: has joined #ruby
[11:16:12] KeyJoo: has joined #ruby
[11:21:19] ravenousmoose: has joined #ruby
[11:40:24] ramfjord: has joined #ruby
[11:52:37] ravenousmoose: has joined #ruby
[12:31:10] blackmesa1: has joined #ruby
[12:37:40] blackmesa1: has joined #ruby
[12:42:32] canton7: has joined #ruby
[12:55:34] EXCHGR: has joined #ruby
[12:55:43] keden: has joined #ruby
[13:06:10] kapil____: has joined #ruby
[13:14:50] AJA4350: has joined #ruby
[13:16:14] jammanbo: Does anyone know of a handy way to munge date formats like DD/MM/CCYY, YYYY-MM-DD, etc. into standard strftime format strings?
[13:21:41] phaul: there is a lot of methods on the Date class that could help you. including .parse and #strftime.
[13:21:53] rubydoc: I found 2 entries matching class Date.
[13:22:14] phaul: &list Date
[13:22:15] rubydoc: Date (date), Date (json)
[13:22:28] phaul: &ri Date (date)
[13:22:29] rubydoc: https://ruby-doc.org/stdlib-2.6/libdoc/date/rdoc/Date.html
[13:26:12] ravenousmoose: has joined #ruby
[13:27:07] leni1: has joined #ruby
[13:28:05] cubillosxy_py: has joined #ruby
[13:28:20] phaul: maybe I misunderstood the question. Example input / output?
[13:29:20] leni1: Hi. Quick question: is this the right place to ask about `bundler` or does `bundler` fall under Ruby on Rails?
[13:30:50] leni1: Never mind. A quick Google says that it is for Ruby.
[13:31:52] leni1: So my question is: I have a system version of bundler installed but the Gemfile.lock was created with a newer version of Ruby. I tried to install a newer version in the folder I was in and it seemed to succeed.
[13:33:56] leni1: However when I run `bundle install`, it seems that the installer is still using the system wide `bundler`. Is there a way to specify which version of `bundler` I'd like to use or specify that the locally installed bundler (local to my project folder) is the one to be used for installing dependencies?
[13:34:47] jammanbo: phaul: Yeah, it's the actual format strings that are the problem. An external source is providing date strings and associated format strings, for the format strings are not compatible with strptime etc., so they would need to be translated into something that strptime could use to parse the date.
[13:35:27] jammanbo: It's not a hug issue, #to_date will probably work 99% of the time.
[13:38:29] jammanbo: leni1: It's not a direct answer, but using something like rbenv would probably help you now and in the future. I like to supplement that with rbenv-gemset for finer grained control.
[13:39:41] leni1: jammanbo: let me look into that. Thanks
[13:44:30] moei: has joined #ruby
[13:53:27] keden: has joined #ruby
[13:53:46] matchaw: has joined #ruby
[14:06:13] nowhereman: has joined #ruby
[14:23:14] AJA4350: has joined #ruby
[14:24:23] ramfjord: has joined #ruby
[14:27:52] blackmesa1: has joined #ruby
[14:36:41] segy: has joined #ruby
[14:37:07] mikker: has joined #ruby
[14:38:56] naltun: has joined #ruby
[14:39:11] naltun: Hey guys. I hope everyone's doing well! I'm getting this error: You don't have write permissions for the /usr/lib/ruby/gems/2.6.0
[14:39:32] naltun: I'm using Arch Linux, and my recent upgrade to 2.6 has apparently broken my gems
[14:40:05] naltun: I can't install gems without SU privileges and then, of course, when running PATHS/privileges/etc. come into effect and I can't run any ruby projects properly
[14:40:24] naltun: I'm trying to use Ruby's FFI for writing Rust + Ruby projects :( Super excited but pretty stumped here
[14:42:45] naltun: Gem home (via bundler env): Gem Home /usr/lib/ruby/gems/2.6.0. Gem Path: /home/naltun/.gem/ruby/2.6.0:/usr/lib/ruby/gems/2.6.0. User Path: /home/naltun/.gem/ruby/2.6.0
[14:48:56] conta: has joined #ruby
[14:50:28] aufi: has joined #ruby
[14:57:06] rippa: has joined #ruby
[14:58:14] bruce_lee: has joined #ruby
[14:59:42] Inline: has joined #ruby
[15:05:42] ravenousmoose: has joined #ruby
[15:06:25] al2o3-cr: naltun: try setting GEM_HOME=$HOME/.gem
[15:08:24] naltun: will do when I get a chance, thanks al2o3-cr :)
[15:11:38] al2o3-cr: naltun: yeah, np.
[15:18:08] ramfjord: has joined #ruby
[15:19:26] skryking: has joined #ruby
[15:22:21] Rapture: has joined #ruby
[15:23:46] DTZUZO: has joined #ruby
[15:30:57] BTRE: has joined #ruby
[15:33:31] AJA4351: has joined #ruby
[15:35:19] polishdub: has joined #ruby
[15:35:45] Dbugger: has joined #ruby
[15:36:30] sebuba: has joined #ruby
[15:39:27] tdy: has joined #ruby
[15:44:21] stryek: has joined #ruby
[15:45:08] skryking: has joined #ruby
[15:50:50] naltun: al2o3-cr, I'm getting the error still. gem env output -> https://gist.github.com/naltun/a0d3993d7d8f34aefffdd98f33dd589d
[15:51:48] naltun: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/lib/ruby/gems/2.6.0 directory.
[15:53:58] zapata: has joined #ruby
[15:59:37] blackmesa1: has joined #ruby
[16:00:02] al2o3-cr: naltun: how did you set GEM_HOME?
[16:00:21] naltun: .zshrc file
[16:00:34] al2o3-cr: naltun: did you export it?
[16:00:59] al2o3-cr: as in `export GEM_HOME=$HOME/.gem'
[16:01:55] al2o3-cr: did you restart the shell?
[16:02:11] naltun: Ah bollocks I got it
[16:02:22] naltun: I was working in the wrong terminal that didn't have the latest changes
[16:02:40] naltun: Sorry mate lacked a bit of attention-to-detail :P
[16:02:47] al2o3-cr: naltun: ah. no worries.
[16:03:00] naltun: but your original suggestion worked, setting the GEM_HOME variable. Awesome
[16:03:13] al2o3-cr: good good ;)
[16:05:19] Fusl: has joined #ruby
[16:07:46] ChanServ: +o havenwood
[16:22:51] GodFather: has joined #ruby
[16:26:31] davidw_: has joined #ruby
[16:31:54] matchaw_: has joined #ruby
[16:32:46] matchaw_: has joined #ruby
[16:37:30] duderonomy: has joined #ruby
[16:38:32] havenwood: https://www.ruby-lang.org/en/news/2019/01/30/ruby-2-6-1-released/
[16:41:56] ravenousmoose: has joined #ruby
[16:43:33] snuz: has joined #ruby
[16:44:57] conta1: has joined #ruby
[16:45:56] naltun: havenwood, woohoo!
[16:46:30] al2o3-cr: &>> [128077].pack('U')
[16:46:37] rubydoc: # => "\u{1F44D}" (https://carc.in/#/r/64nw)
[16:48:03] nowhereman: has joined #ruby
[16:48:39] al2o3-cr: i keep forgetting carc.in in binary :(
[16:49:40] phaul: >> [128077].pack('U')
[16:50:20] al2o3-cr: &>> Encoding.default_external = 'utf-8'; [128077].pack('U')
[16:50:21] rubydoc: # => "πŸ‘" (https://carc.in/#/r/64nx)
[16:51:48] \void: has joined #ruby
[16:52:37] foxxx0: has joined #ruby
[16:53:21] al2o3-cr: phaul: that's the nit.
[16:54:09] foxxx0_: has joined #ruby
[16:55:57] al2o3-cr: &>> ([128077]*7).pack('U7').b.force_encoding 'utf-8'
[16:55:58] rubydoc: # => "\u{1F44D}\u{1F44D}\u{1F44D}\u{1F44D}\u{1F44D}\u{1F44D}\u{1F44D}" (https://carc.in/#/r/64ny)
[16:56:42] al2o3-cr: 7 thumbs ;)
[16:57:01] foxxx0_: has joined #ruby
[16:58:17] phaul: ruby_bot came back to life a few weeks back, but seems it was short lived revival
[16:58:37] al2o3-cr: >> ([128077]*7).pack('U7')
[16:59:21] al2o3-cr: hmm..... i think its gone to the knackered yard :(
[17:00:45] al2o3-cr: it's not the bot that's temperamental its eval.in.
[17:01:32] al2o3-cr: but saying that, we're not even getting a response now?
[17:02:02] phaul: well, we are better of with carc.in anyways, as we have jhass in the channel! :)
[17:03:39] naltun: al2o3-cr, are you from Ireland/Britain?
[17:04:42] al2o3-cr: phaul: true ;)
[17:04:56] al2o3-cr: naltun: latter ;)
[17:05:07] naltun: Ahhh, which part?
[17:05:15] naltun: I've been known to be 'Aberdonian' from time to time
[17:05:24] al2o3-cr: naltun: Manchester.
[17:05:28] naltun: Good Northease o' Scotland ;)
[17:05:34] naltun: Northeast**
[17:06:18] al2o3-cr: broughty ferry
[17:06:38] al2o3-cr: crocodile dundee lol ')
[17:07:27] phaul: I've never been further up than Birmingham, spent a few days rambling in the Peaks
[17:07:48] phaul: about 7 years ago :D
[17:08:47] al2o3-cr: phaul: you like to go on adventures?
[17:09:20] phaul: you are asking a man who have been non-stop sailing in the poast 3 years
[17:09:41] phaul: so I think I qualify :)
[17:09:47] perique: has joined #ruby
[17:09:56] al2o3-cr: awesome phaul :)
[17:10:24] al2o3-cr: bit of a daft question that tbh ;)
[17:15:13] al2o3-cr: my dad was that tight, he could peel an orange in his pocket hehe
[17:15:54] naltun: phaul, you're a sailer? Ugh mate, that's my dream
[17:16:17] phaul: naltun: it's easy to try first without much commitment
[17:16:33] phaul: google day skipper /competent crew curses first
[17:16:44] naltun: I was in Caernarfon, North Wales a few years ago and met some older gents who just came back from their sailing cert course. 5 days at sea.
[17:17:01] naltun: Aye, the competent crew course
[17:17:11] phaul: any RYA approved place
[17:17:16] naltun: RYA course
[17:17:38] naltun: Although I love Scotland, I'd love to take the course in Wales if I can.
[17:18:05] naltun: I follow r/sailing on Reddit. Good place to keep the spark alive
[17:18:53] BLuEGoD: has joined #ruby
[17:24:09] al2o3-cr: david gray's, sail away with me (very good)
[17:27:42] galaxie: has left #ruby: ()
[17:28:28] ravenousmoose: has joined #ruby
[17:32:20] foxxx0_: has joined #ruby
[17:34:20] Tempesta: has joined #ruby
[17:37:20] krawchyk: has joined #ruby
[17:43:38] baweaver: havenwood: Who do we know that works on Rubocop?
[17:44:08] baweaver: Looking to get rewriter promoted to more of a first-class gem
[17:45:38] Nicmavr: has joined #ruby
[17:49:08] orbyt_: has joined #ruby
[17:52:52] cd: has joined #ruby
[17:55:59] havenwood: baweaver: Hmm, our own segiddiins or Pan over at Strava, maybe?
[17:56:10] ChanServ: -o havenwood
[17:57:14] havenwood: baweaver: Maybe koic? He's been committing a lot lately.
[17:58:08] lxsameer: has joined #ruby
[18:01:52] sonofentropy: has joined #ruby
[18:04:36] ryovaa: has joined #ruby
[18:05:33] skryking: has joined #ruby
[18:07:46] mikecmpbll: has joined #ruby
[18:08:35] r29v: has joined #ruby
[18:10:16] cek: has joined #ruby
[18:10:35] agent_white: has joined #ruby
[18:15:46] code_zombie: has joined #ruby
[18:16:35] cek: what entry function is executed for a compiled module? When a lib is required, its main file gets evaluated, but what happens in C?
[18:16:54] bruce_lee: has joined #ruby
[18:18:57] cek: bruce_lee?
[18:19:13] bruce_lee: \(^_^)/ @all
[18:20:25] al2o3-cr: bruce_lee: you still flow like water?
[18:20:51] al2o3-cr: become the tea cup.
[18:23:07] blackmesa1: has joined #ruby
[18:23:45] conta1: has joined #ruby
[18:24:32] ryovaa: flow... or crash
[18:28:50] minimal_life: has joined #ruby
[18:31:16] al2o3-cr: bruce lee's quotes are the educating.
[18:35:45] josh_newbie: has joined #ruby
[18:36:17] cek: has left #ruby: ()
[18:36:34] josh_newbie: is it possible in Ruby to write a method that will accept <<END (i wish to append a content to a file using a method) ?
[18:40:16] jgw: has left #ruby: ()
[18:43:01] bruce_lee: has joined #ruby
[18:43:49] mozzarella: josh_newbie: yes
[18:48:54] tdy: has joined #ruby
[18:48:58] josh_newbie: mozzarella, thank's, is this the good way to do that => https://gist.github.com/wesley974/614d7473e47e74278db40ef7c0bfc301 ?
[18:53:25] bruce_lee: josh_newbie: looks nice to me, but I'm really not an experienced "programmer"
[18:54:12] josh_newbie: Bruce, i'm a fan of you!
[18:54:42] cubillosxy_py: has joined #ruby
[18:54:48] houhoulis: has joined #ruby
[18:56:13] cubillosxy_py: hi there, i need to decode a jwt encrypted with a public_key, how to do that? pd: i am beginner in ruby
[18:57:13] al2o3-cr: cubillosxy_py: ask havenwood
[18:57:31] bruce_lee: what is "jwt"?
[18:57:33] mozzarella: josh_newbie: what do you mean by "good way"?
[18:57:52] josh_newbie: i mean best practice
[18:58:22] josh_newbie: perhaps theres already a gem for this kind of operation ... ?
[18:58:25] mozzarella: you can put your closing paren on the same line as the opnening one, but I'm not sure that's considered better
[18:58:40] al2o3-cr: josh_newbie: i think there is a gem for this
[18:58:43] havenwood: bruce_lee: It's a little standard for representing signed/encrypted/plain text content over the wire as base64 encoded JSON: https://jwt.io/
[18:59:34] havenwood: josh_newbie: https://gist.github.com/havenwood/b0191cb6749c9c8dc4fb3685961a6916
[19:00:25] havenwood: oops, responded to the wrong person! sorry josh_newbie
[19:00:34] havenwood: cubillosxy_py: https://gist.github.com/havenwood/b0191cb6749c9c8dc4fb3685961a6916
[19:00:47] josh_newbie: havenwood: no problem
[19:01:10] havenwood: cubillosxy_py: There are a few nice Ruby JWT gems. Here's one: https://github.com/jwt/ruby-jwt
[19:01:17] josh_newbie: al2o3-cr: which one ? (gem)
[19:01:18] Dreamer3: has joined #ruby
[19:01:38] josh_newbie: al2o3-cr: tty-file ?
[19:01:54] havenwood: cubillosxy_py: You'll just need to check the algorithm, which is in the payload. Ping us if you have trouble.
[19:02:46] al2o3-cr: josh_newbie: you don't need a gem for this. your example is ample ;)
[19:03:18] sonofentropy: has joined #ruby
[19:03:18] havenwood: josh_newbie: Is there a part of your example you're worried about?
[19:03:23] josh_newbie: thank's everyone!
[19:05:04] Renich: has joined #ruby
[19:05:54] havenwood: josh_newbie: It looks like you already knew this, since you added newlines in your example, but #<< won't add a newline.
[19:06:13] cubillosxy_py: havenwood, ok i am using python for encode with rs256, i encrypt with private key and decrypt with public_key and works in python
[19:06:19] havenwood: josh_newbie: If you want an implicit newline: file.puts content
[19:07:53] havenwood: cubillosxy_py: The jwt gem should work nicely: JWT.decode token, rsa_public, true, { algorithm: 'RS256' }
[19:16:43] orbyt_: has joined #ruby
[19:19:24] cubillosxy_py: havenwood, i get this error verify_rsa': undefined method `verify' for #<String:0x0 , https://dpaste.de/Z0an
[19:21:48] ravenousmoose: has joined #ruby
[19:22:25] havenwood: cubillosxy_py: Hrm, that looks right to me.
[19:23:17] havenwood: cubillosxy_py: An aside, but you can drop the "./" from File.read. I'll try to reproduce when i get a min.
[19:26:32] havenwood: cubillosxy_py: Ah, it's expecting `public_key` to be an instance of OpenSSL::PKey::RSA, not a String.
[19:27:42] cubillosxy_py: now eds.rb:13:in `initialize': Neither PUB key nor PRIV key: nested asn1 error (OpenSSL::PKey::RSAError)
[19:28:22] cubillosxy_py: https://dpaste.de/Pdw8#L
[19:33:34] laaron: has joined #ruby
[19:36:02] havenwood: cubillosxy_py: Hrm. I can't reproduce from an RS256 created locally: https://gist.github.com/havenwood/90067d0e37353f0e8dc5a0dfc7868952
[19:37:27] havenwood: cubillosxy_py: Does that same public_key work to decrypt from Python?
[19:38:07] akemot: has joined #ruby
[19:38:37] havenwood: cubillosxy_py: Does the public_key start with?: -----BEGIN PUBLIC KEY-----\n
[19:40:42] al2o3-cr: havenwood: probably needs a; OpenSSL::PKey::RSA.new([pub].pack('m0'))
[19:45:20] havenwood: al2o3-cr: Yeah, it'd not surprise me if ti was a der and that'd do the trick.
[19:47:53] havenwood: "-----BEGIN PUBLIC KEY-----\n#{[rsa_public.to_der].pack('m0')}\n-----END PUBLIC KEY-----\n"
[19:48:18] al2o3-cr: havenwood: exactly.
[19:49:02] havenwood: cubillosxy_py: Is your `pub` bytes? If so, see ^
[19:49:51] GodFather: has joined #ruby
[19:50:48] al2o3-cr: cubillosxy_py: just paste your public key.
[19:51:57] al2o3-cr: i'm mean your private.... joke ;)
[19:57:19] nchambers: has joined #ruby
[19:57:57] skryking: has joined #ruby
[20:02:12] al2o3-cr: cubillosxy_py: any progress?
[20:02:17] AJA4350: has joined #ruby
[20:09:23] al2o3-cr: cubillosxy_py: try converting public key to pem.
[20:10:20] SeepingN: has joined #ruby
[20:12:51] reber: has joined #ruby
[20:16:32] dviola: has joined #ruby
[20:20:33] donofrio_: has joined #ruby
[20:25:05] cnsvc: has joined #ruby
[20:31:14] gix: has joined #ruby
[20:33:33] shlomif: has joined #ruby
[20:37:48] cubillosxy_py: has joined #ruby
[20:39:08] cubillosxy_py: havenwood: thanks , that works I need only convert the key.pub to pem
[20:40:10] havenwood: cubillosxy_py: πŸ‘πŸ½
[20:47:14] matchaw: has joined #ruby
[20:50:32] skryking: has joined #ruby
[21:06:07] zephiro: has joined #ruby
[21:09:58] ramfjord: has joined #ruby
[21:18:39] millerti: has joined #ruby
[21:22:13] al2o3-cr: i'm being followed by a moonshadow, moonshadow, moonshadow.
[21:27:34] cthulchu_: has joined #ruby
[21:58:19] Xeago_: has joined #ruby
[22:02:34] yoshie902a: has joined #ruby
[22:03:30] yoshie902a: Need database design help… 1 to 1 polymorphic vs none. See here.. https://stackoverflow.com/questions/54442282/1-to-1-polymorphic-relationship-vs-none-ruby-on-rails
[22:06:42] al2o3-cr: yoshie902a: tough question. really, you'd get better answers on #rubyonrails
[22:07:17] al2o3-cr: but hang about, you never know.
[22:09:27] yoshie902a: al2o3-cr: Happy to get answer from any where, but have not been able to get a response from anywhere.
[22:10:28] al2o3-cr: hold tight, it's gonna be a ride then.= ;)
[22:14:04] ravenousmoose[aw: has joined #ruby
[22:31:12] al2o3-cr: &>> class X; def x(i) i.x; end; end; class Y < X; def x; 42 end; end; X.new.x Y.new
[22:31:16] rubydoc: # => 42 (https://carc.in/#/r/64pn)
[22:33:08] lukelukeluke: has joined #ruby
[22:33:41] al2o3-cr: polymorphism, encapulation ... is not as easy one thinks.
[22:34:19] al2o3-cr: encapsulation in ruby is never encapsulation.
[22:35:25] al2o3-cr: i generally hide it in a namespace.
[22:38:29] al2o3-cr: well, that's just not to populate the namespace tbh.
[22:38:50] al2o3-cr: but you get my point.
[22:39:47] ellcs: has joined #ruby
[22:42:25] AJA4350: has joined #ruby
[22:43:46] al2o3-cr: build it up from there.
[22:48:19] nchambers: has joined #ruby
[22:51:08] houhoulis: has joined #ruby
[23:03:19] dinfuehr: has joined #ruby
[23:04:22] yorickpeterse: has joined #ruby
[23:05:41] moei: has joined #ruby
[23:22:37] icy`: has joined #ruby
[23:24:02] zephiro: has joined #ruby
[23:28:16] icy`: hi, having an issue with server recognizing a file attachment when i do an HTTP Post. Aren't you just supposed to be able to give the file handle as part of the request body? Looks something like this atm https://pastebin.com/VC4Xw5h0 Response i get back is that no file was uploaded. If I add a .read then an error is rescued with something about ASCII to UTF-8 conversion. I can't get rest-client gem
[23:28:16] icy`: cause my ruby is 2.6 and that's too new for unf_ext dependency
[23:39:17] raulp: has joined #ruby
[23:43:11] icy`: thinking my core issue is just malformed "form data" body. I'll try to follow https://yukimotopress.github.io/http , the section "File Upload - HTML Style" later tonight
[23:43:55] icy`: rest-client probably just adds those missing headers that I needed around the file itself. It does indeed look like the file needs to be read, as in that example and file handle is not enough
[23:50:37] akemot: has joined #ruby
[23:55:05] rkazak: has joined #ruby
[23:55:30] ericboehs: has joined #ruby