vendor/bundle/ruby/2.7.0/gems/dnsruby-1.61.5/lib/dnsruby/update.rb
# Ways to create the update records (add, delete, RFC2136, section 2.5)
#   " 2.5.1 - Add To An RRset
#
#    RRs are added to the Update Section whose NAME, TYPE, TTL, RDLENGTH
#    and RDATA are those being added, and CLASS is the same as the zone
#    class.  Any duplicate RRs will be silently ignored by the primary
#    master."
#
#    update.add(rr)
#    update.add([rr1, rr2])
#    update.add(name, type, ttl, rdata)
#
Ways to create the update records (add, delete, RFC2136, section 2.5)
" 2.5.1 - Add To An RRset

RRs are added to the Update Section whose NAME, TYPE, TTL, RDLENGTH
and RDATA are those being added, and CLASS is the same as the zone
class.  Any duplicate RRs will be silently ignored by the primary
master."


Ways to create the update records ( add delete RFC2136 section 2 . 5 ) " 2 . 5 . 1 - Add To An RRset RRs are added to the Update Section whose NAME TYPE TTL RDLENGTH and RDATA are those being added and CLASS is the same as the zone class . Any duplicate RRs will be silently ignored by the primary master . "
def add(*args)
      zoneclass=zone()[0].zclass
      case args[0]
      when Array
        args[0].each do |resource|
          add(resource)
        end
      when RR
        resource = args[0]
        if (resource.klass != zoneclass)
          raise ArgumentError.new("Wrong class #{resource.klass} for update (should be #{zoneclass})!")
        end
        add_update(resource)
        return resource
      else
        name=args[0]
        type=args[1]
        ttl=args[2]
        rdata=args[3]
        resource = nil
        if (Types.new(type) == Types.TXT)
          instring = "#{name} #{ttl} #{zoneclass} #{type} ";
          if (String === rdata)
            instring += " '#{rdata}'"
          elsif (Array === rdata)
            rdata.length.times {|rcounter|
            instring += " '#{rdata[rcounter]}' "
            }
          else
            instring += rdata
          end
          resource = RR.create(instring)
        else
          resource = RR.create("#{name} #{ttl} #{zoneclass} #{type} #{rdata}")
        end
        add_update(resource)
        return resource
      end
    end
def add ( * args ) zoneclass = zone ( ) [ 0 ] . zclass case args [ 0 ] when Array args [ 0 ] . each do | resource | add ( resource ) end when RR resource = args [ 0 ] if ( resource . klass != zoneclass ) raise ArgumentError . new ( "Wrong class #{resource.klass} for update (should be #{zoneclass})!" ) end add_update ( resource ) return resource else name = args [ 0 ] type = args [ 1 ] ttl = args [ 2 ] rdata = args [ 3 ] resource = nil if ( Types . new ( type ) == Types . TXT ) instring = "#{name} #{ttl} #{zoneclass} #{type} " ; if ( String === rdata ) instring += " '#{rdata}'" elsif ( Array === rdata ) rdata . length . times { | rcounter | instring += " '#{rdata[rcounter]}' " } else instring += rdata end resource = RR . create ( instring ) else resource = RR . create ( "#{name} #{ttl} #{zoneclass} #{type} #{rdata}" ) end add_update ( resource ) return resource end end
Ways to create the update records (add, delete, RFC2136, section 2.5)
" 2.5.1 - Add To An RRset
Ways to create the update records ( add delete RFC2136 section 2 . 5 ) " 2 . 5 . 1 - Add To An RRset
#  Make sure that the Class is the same as the zone #  @TODO@ Should be able to take RRSet!
args
<not_specific>