Sylar Sylar - 1 month ago 23
Ruby Question

Return Hash Date Value

I have an hash like this:

value = {Fri, 14 Oct 2016=>58.0}


How to return the date's value which is
58.0
?

Not much help from the docs.

Have tried
value["#{DateTime.now}"]
but that returns
0
.

Answer

If that key is a date object try

value[Date.new(2016, 10, 14)]
Comments