Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
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`.
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.
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.
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.