def to_hash
      converter = lambda { |obj| obj.respond_to?(:to_hash) ? obj.to_hash : obj }
      self.class.rules.keys.inject({}) do |hash, name|
        value = send(name)
        hash[name.to_sym] = Array === value ? value.map(&converter) : converter[value]
        hash
      end
    end
def to_hash
      converter = lambda { |obj| obj.respond_to?(:to_hash) ? obj.to_hash : obj }
      self.class.rules.keys.inject({}) do |hash, name|
        value = send(name)
        hash[name.to_sym] = Array === value ? value.map(&converter) : converter[value]
        hash
      end
    end
Dump the extracted data into a hash with symbolized keys