Class: Resolv::DNS::SvcParam::Generic

Inherits:
SvcParam
  • Object
show all
Defined in:
lib/resolv.rb

Overview

Generic SvcParam abstract class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Generic

Create generic SvcParam



2052
2053
2054
# File 'lib/resolv.rb', line 2052

def initialize(value)
  @value = value
end

Instance Attribute Details

#value ⇒ Object (readonly)

SvcParamValue in wire-format byte string.



2047
2048
2049
# File 'lib/resolv.rb', line 2047

def value
  @value
end

Class Method Details

.create(key_number) ⇒ Object



2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
# File 'lib/resolv.rb', line 2064

def self.create(key_number)
  c = Class.new(Generic)
  key_name = :"key#{key_number}"
  c.const_set(:KeyName, key_name)
  c.const_set(:KeyNumber, key_number)
  # Not registered in a constant or in ClassHash. ClassHash creates a
  # class for every unknown SvcParamKey, so registering them
  # permanently would let a malicious response exhaust memory.
  return c
end

.decode(msg) ⇒ Object

:nodoc:



2060
2061
2062
# File 'lib/resolv.rb', line 2060

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

Instance Method Details

#encode(msg) ⇒ Object

:nodoc:



2056
2057
2058
# File 'lib/resolv.rb', line 2056

def encode(msg) # :nodoc:
  msg.put_bytes(@value)
end