#ruby - 29 April 2019
« Back 1 day Forward 1 day »
[04:49:28] CableNinja: hey guys. I'm trying to do an SSL server/client setup (straight tcp/ssl via TCP/SSL network sockets). I'm struggling to get a complete connection. using openssl_sclient I get correct info, but when I connect using the ruby client I get "unexpected message" on the client side, and "wrong version number" on the server side. Both are running on the same system, I updated to openssl 1.1.1b, and rebuilt ruby/openssl with it, but I still
[13:48:43] ech0s7: adam12: I'm reading a json config file into an hash object and I would like to access the hash using obj[:key] instead of obj["key"]
[13:49:56] adam12: ech0s7: Couple methods. If you're using Rails, there's a symbolize_keys! method on Hash.
[13:50:09] adam12: ech0s7: If you're not, I believe JSON will accept an argument to symbolize keys/names.
[14:21:49] ngw: hi *, is there an easy way to parse multipart data in plain ruby? I know Rack has the code for doing that but I'm building an AWS lambda, I feel silly requiring Rack for nothing
[14:22:39] adam12: ngw: I haven't seen anything but maybe you can dig through the CGI library in stdlib?
[14:39:06] ngw: eh, it's quite out of scope with what I'm doing, I hate helpers/libs when completely out of scope with the project
[16:32:46] ech0s7: I'm looking for an elegant way to return an array from a function only if it is not empty
[17:44:53] Swyper: rspec ./spec/0_hangman_spec.rb:116 # Hangman PART 1 #get_matching_indices should return an array containing all indices of @secret_word where the char can be found
[17:46:02] Swyper: I see find_index, and I know I can just iterate through the elements of the array to solve this - just wondering if there a simpler ruby way to implement this
[17:49:25] Swyper: I could do each_with_index and store the indexes where there is a match in a new array
[17:53:42] phaul: so you can include the indices, you still get an Enumerator, which is Enumerable, so everything in the Enumerable interface is available select, sort etc
[23:01:36] phaul: it's more like " there is many different scopes" and it all depends on the context
[23:03:05] phaul: probably it was correct, but maybe incomplete. there is scope for constant lookup. there is scope for variablbe lookup, there is the current self, etc
[23:10:12] phaul: yeah,. the main thing is to ask, what you are trying to look up. then that defines the scope for it
[23:18:34] phaul: I did this thing it might be or might not be useful, but here it is https://github.com/phaul/ruby_101/blob/master/content/book.md#constant-visibility-and-lexical-scopes
[23:45:02] CableNinja: hey guys, I was in here askin last night, but didnt get a response. trying to do an SSL server/client setup (straight tcp/ssl via TCP/SSL network sockets). I'm struggling to get a complete connection. using openssl_sclient I get correct info, but when I connect using the ruby client I get "unexpected message" on the client side, and "wrong version number" on the server side. Both are running on same system, running same ssl version