# File lib/dnsruby/resource/RR.rb, line 322
  def ==(other)
    return false unless self.class == other.class

    ivars_to_compare = ->(object) do
      ivars = object.instance_variables.map { |var| var.to_s }
      ivars.delete '@ttl' # RFC 2136 section 1.1
      ivars.delete '@rdata'
      if self.type == Types.DS
        ivars.delete '@digest'
      end
      ivars.sort
    end

    get_instance_var_values = ->(object, ivar_names) do
      ivar_names.map { |ivar_name| object.instance_variable_get(ivar_name) }
    end

    self_ivars  = ivars_to_compare.(self)
    other_ivars = ivars_to_compare.(other)
    return false unless self_ivars == other_ivars

    self_values  = get_instance_var_values.(self, self_ivars)
    other_values = get_instance_var_values.(other, other_ivars)
    self_values == other_values
  end