Page 1 of 1
[03:47:00] dessm: changes as well. I'd like to keep the original payload around without modifying it, so I usually marshal dump/load the new hashes before modifying them. This seems absurdly kludgy and leads me to believe that I'm somehow approaching the problem in a wholly un-Rubyesque way. What is the Ruby way to handle this situation?
[03:47:00] dessm: Good evening. I've been wondering about the following: Often times when dealing with external APIs I'll get back some rather large JSON payload which I then parse into a Ruby hash. Usuallly I need specific parts of that hash so I might make a bunch of new hashes like: random_hash = payload[:some_key][:another_key] etc. Now the problem that I run into is that I need to transform that data. But when I modify the new hashes random_hash
[01:05:32] dessm: Hi, I am not sure if it's okay to ask questions here (I apologize if it isn't), but I have what I suspect is a ridiculously easy question that I can't find the answer to despite extensive googling. I am trying to access an epub file from within a script tag in a view. Where do I need to save the file and how do I specify the path? I tried assets and indicating the full path without any...
[01:05:34] dessm: ...success. Any pointers of what might be going on or where I can find further information would be greatly appreciated. Thanks.
[20:16:32] dessm: Hello :) I am struggling to understand the following: "123".to_i is an integer; "123".to_i.class returns Integer; yet "123".to_i.class.is_a?(Integer) returns false. Why is this? Thank you.
[20:21:46] dessm: ah I see. So how would I then check whether something is of a particular class if this approach doesn't work?
[20:32:37] dessm: Yeah I just realized that by trying it out in the irb. Thanks again everyone, sometimes these little issues can cost a lot of time while learning without out providing much benefit so it can be quite helpful to have someone point out these kind of mistakes (even if they should be obvious) :)
[02:41:12] dessm: Hi, I have three questions. I am wondering why (Q1) exactly and how (Q2) 'first' works on hashes. 'first' is neither listed in the ruby documentation under hashes nor is it listed in the irb if I type Hash.methods. I suspect that my understanding is still too deficient to google this properly since my search terms don't seem to turn up answers to the question. Q3: I am also wondering if...
[02:41:14] dessm: ...'first' indeed does work on hashes where I might find a COMPLETE list of all the methods that can be applied to hashes.Thank you :)
[01:04:14] dessm: Hi, I'm not sure if it's okay to ask questions here, so apologies if I'm breaching etiquette. I'm doing the Ruby koans and was wondering why, if I have an array=[1,2,3], array[3,0] == , but array[4,0] == nil? Since both start indices are beyond the indeces of the array wouldn't one expect them to return the same value? Thank you.