Hey everyone,
I have a quick question on retrieving information from a hash, here is the code thus far:
permits_sheet.each do |row|
rate_type = row[0].to_s #Converts the rate type (title) to a string
row.shift #Removes the title from hash so it's not added to values
row.each do |values|
split_value = values.split ('=') #References relations from an excel sheet pulled in earlier. EG: T=2324, W=8633
(@@permits_hash[rate_type] ||= []) << {split_value[0].to_s => split_value[1]} #Multiple values exist within each title
end
end
puts @@permits_hash['R']['T'] #In this example I'm searching for the hash key of T under the R title. I expected it to return the 2324 from the example above.
When attempting to retrieve information in this manner it results in an error. I'm sure I just did something stupid, but any help would be greatly appreciated (haven't used Ruby in quite awhile).
Thanks for the help!