Say I have an array, and I use the keep_if or select methods to delete everything but one object for the array -- is there a way to take that object out of the array, so it's not an array any more?
For example, the way my models are set up, previous and current will only ever have one object.
def more_or_less?(project, current_day)
words = project.words
current = words.select {|w| w.wrote_on == current_day}
previous = words.select {|w| w.wrote_on == (current_day - 1.day)}
end
So, if I want to do a comparison, like if current.quantity > previous.quantity -- I've resorted to actually writing if current.last.quantity > previous.last.quantity but I'm assuming there's a more idiomatic way?