Skip to main content
Bradley Marques's user avatar
Bradley Marques's user avatar
Bradley Marques's user avatar
Bradley Marques
  • Member for 8 years, 6 months
  • Last seen more than 8 years ago
awarded
awarded
awarded
awarded
awarded
revised
Seeding a database
Qualified that the asker may need to implement a specific function if he/she hasn't done so already
Loading…
awarded
answered
Loading…
revised
Seeding a database
Removed comment that 'the code works but is not good'. That is the nature of questions on this site. Corrected some English, and renamed the file to `seeds.rb`.
Loading…
suggested
Approve
awarded
comment
Ruby class to model (pre)historical Dates with (im)precision
Thanks for the additional feedback. I also found this StackOverflow question and this book that support the fact that public_send (and send) is acceptable to use. Thanks once again.
comment
Ruby class to model (pre)historical Dates with (im)precision
Thanks so much. You are quite correct about the :level key being unused, and with the repeated ArgumentError for invalid dates. I have 2 questions about your proposal for Formatter. First, did you purposefully symbolize :nil? Secondly, is it not a bit 'dirty' to call functions by a name, with public_send? It seems like it could backfire somehow by allowing client code to call an unwanted function.
revised
Ruby class to model (pre)historical Dates with (im)precision
Corrected bug in code. Changed ranges (0..60) to (0..59) for validation of second and minute.
Loading…
Loading…
comment
Merge array of hashes, keeping duplicate values as arrays
Huh, I see your point about the mixed data types. Thanks for the good advice.
comment
Merge array of hashes, keeping duplicate values as arrays
Thanks for the answer and for the link to facets; I didn't know about it.
comment
Merge array of hashes, keeping duplicate values as arrays
I think this is good, because it doesn't check for nil? explicitly and only has one h[k] = assignment. In addition, it gets rid of the Array.new() and the flatten, as you mentioned.