Fetching values based on keys from hash

76 views Asked by At

I am using roo gem for reading an xlsx file.

sheet.each(identifier: 'identifier',name: 'name') do |hash|
  puts hash.inspect
  puts hash['identifier'] => prints empty
end

inspect correctly gives all the hash with all the key/ value pairs

{:identifier=>"3254",:name=>"Ins"}.....so on 

I need to fetch the value based on key at every loop. Did something like this puts hash['identifier'] which does not print anything.

How to achieve this.

0

There are 0 answers