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

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

Overview

A generic resource abstract class.

Constant Summary

Constants inherited from Gem::Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Attributes inherited from Gem::Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Resolv::DNS::Resource

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

Constructor Details

#initialize(data) ⇒ Generic

Creates a new generic resource.



2148
2149
2150
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2148

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Data for this generic resource.



2155
2156
2157
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2155

def data
  @data
end

Class Method Details

.create(type_value, class_value) ⇒ Object

:nodoc:



2165
2166
2167
2168
2169
2170
2171
2172
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2165

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:



2161
2162
2163
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2161

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

Instance Method Details

#encode_rdata(msg) ⇒ Object

:nodoc:



2157
2158
2159
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2157

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