def recursive_like?(other, data = @data)
      raise "Can't compare with object type: #{other.class}! Must respond_to :each" unless other.respond_to?(:each)
      other.each do |key, val|
        return false unless data && data.respond_to?(:[])
        if val.is_a?(Hash)
          return false unless data.class == Hash && recursive_like?(val, data[key.to_s])
        elsif val.is_a?(Array) && val.first.is_a?(Hash)
          data_array = data[key.to_s] || data[key.to_sym]
          return false unless data_array.is_a?(Array)
          val.each do |other_item|
            return false unless data_array.find { |data_item| recursive_like?(other_item, data_item) }
          end
        elsif val.to_s != data[key.to_s].to_s && val.to_s != data[key.to_sym].to_s
          return false
        end
      end
      true
    end
def recursive_like?(other, data = @data)
      raise "Can't compare with object type: #{other.class}! Must respond_to :each" unless other.respond_to?(:each)
      other.each do |key, val|
        return false unless data && data.respond_to?(:[])
        if val.is_a?(Hash)
          return false unless data.class == Hash && recursive_like?(val, data[key.to_s])
        elsif val.is_a?(Array) && val.first.is_a?(Hash)
          data_array = data[key.to_s] || data[key.to_sym]
          return false unless data_array.is_a?(Array)
          val.each do |other_item|
            return false unless data_array.find { |data_item| recursive_like?(other_item, data_item) }
          end
        elsif val.to_s != data[key.to_s].to_s && val.to_s != data[key.to_sym].to_s
          return false
        end
      end
      true
    end
def recursive_like? ( other , data = @data ) raise "Can't compare with object type: #{other.class}! Must respond_to :each" unless other . respond_to? ( :each ) other . each do | key , val | return false unless data && data . respond_to? ( :[] ) if val . is_a? ( Hash ) return false unless data . class == Hash && recursive_like? ( val , data [ key . to_s ] ) elsif val . is_a? ( Array ) && val . first . is_a? ( Hash ) data_array = data [ key . to_s ] || data [ key . to_sym ] return false unless data_array . is_a? ( Array ) val . each do | other_item | return false unless data_array . find { | data_item | recursive_like? ( other_item , data_item ) } end elsif val . to_s != data [ key . to_s ] . to_s && val . to_s != data [ key . to_sym ] . to_s return false end end true end
Recursive helper method for like?
 Allows comparison of nested hash structures
Recursive helper method for like? Allows comparison of nested hash structures