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

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

Overview

A generic resource abstract class.

Constant Summary

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Attributes inherited from Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::Resource

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

Constructor Details

#initialize(data) ⇒ Generic

Creates a new generic resource.


1724
1725
1726
# File 'lib/resolv.rb', line 1724

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Data for this generic resource.


1731
1732
1733
# File 'lib/resolv.rb', line 1731

def data
  @data
end

Class Method Details

.create(type_value, class_value) ⇒ Object

:nodoc:


1741
1742
1743
1744
1745
1746
1747
1748
# File 'lib/resolv.rb', line 1741

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:


1737
1738
1739
# File 'lib/resolv.rb', line 1737

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

Instance Method Details

#encode_rdata(msg) ⇒ Object

:nodoc:


1733
1734
1735
# File 'lib/resolv.rb', line 1733

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