Class: Resolv::DNS::Resource::Generic

Inherits:
Resolv::DNS::Resource show all
Defined in:
lib/net/dns/resolv.rb

Constant Summary

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::Resource

#==, #eql?, get_class, #hash

Constructor Details

#initialize(data) ⇒ Generic

Returns a new instance of Generic.



1506
1507
1508
# File 'lib/net/dns/resolv.rb', line 1506

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



1509
1510
1511
# File 'lib/net/dns/resolv.rb', line 1509

def data
  @data
end

Class Method Details

.create(type_value, class_value) ⇒ Object

:nodoc:



1519
1520
1521
1522
1523
1524
1525
1526
# File 'lib/net/dns/resolv.rb', line 1519

def self.create(type_value, class_value) # :nodoc:
  c = Class.new(Generic)
  c.const_set(:TypeValue, type_value)
  c.const_set(:ClassValue, class_value)
  Generic.const_set("Type#{type_value}_Class#{class_value}", c)
  ClassHash[[type_value, class_value]] = c
  return c
end

.decode_rdata(msg) ⇒ Object

:nodoc:



1515
1516
1517
# File 'lib/net/dns/resolv.rb', line 1515

def self.decode_rdata(msg) # :nodoc:
  return self.new(msg.get_bytes)
end

Instance Method Details

#encode_rdata(msg) ⇒ Object

:nodoc:



1511
1512
1513
# File 'lib/net/dns/resolv.rb', line 1511

def encode_rdata(msg) # :nodoc:
  msg.put_bytes(data)
end