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



1955
1956
1957
# File 'lib/resolv.rb', line 1955

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

SvcParamValue in wire-format byte string.



1950
1951
1952
# File 'lib/resolv.rb', line 1950

def value
  @value
end

Class Method Details

.create(key_number) ⇒ Object



1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
# File 'lib/resolv.rb', line 1967

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:



1963
1964
1965
# File 'lib/resolv.rb', line 1963

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

Instance Method Details

#encode(msg) ⇒ Object

:nodoc:



1959
1960
1961
# File 'lib/resolv.rb', line 1959

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