def to_hash
      @relations.each_with_object({}) do |(rel,val), obj|
        rel = rel.to_s

        hashed_val = val.map(&:to_hash)
        if val.length == 1 && !single_item_arrays?
          hashed_val = val.first.to_hash
        end

        obj[rel] = hashed_val
      end
    end
def to_hash
      @relations.each_with_object({}) do |(rel,val), obj|
        rel = rel.to_s

        hashed_val = val.map(&:to_hash)
        if val.length == 1 && !single_item_arrays?
          hashed_val = val.first.to_hash
        end

        obj[rel] = hashed_val
      end
    end
Returns a hash corresponding to the object.

 RelationMap doens't just return @relations because it needs to convert
 correctly when a relation only has a single item.

 @return [Hash] relation map in hash format