Having Rubocop tell me that my Ruby code is stylistically flawless makes me feel very good. No, really.
Below is a good example of someone brand new to Ruby (me!) and someone with Ruby experience (not me!) solving the exact same problem. These two methods have the same goal: accept a string, reverse and return it.
sentence_as_array = sentence.split(" ").reverse!
reversed_string = ""
sentence_as_array.each do |x|
reversed_string = reversed_string + x + " "
sentence.split(" ").reverse.join(" ")
It's crazy how much more elegant the second method is.
Last Five Movies I've Seen:
Other Cool-ish Stuf: