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

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

Overview

Generic SvcParam abstract class.

Constant Summary

Constants inherited from Resolv::DNS::SvcParam

ClassHash

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::SvcParam

key_name, key_number

Constructor Details

#initialize(value) ⇒ Generic

Create generic SvcParam



1861
1862
1863
# File 'lib/resolv.rb', line 1861

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

SvcParamValue in wire-format byte string.



1856
1857
1858
# File 'lib/resolv.rb', line 1856

def value
  @value
end

Class Method Details

.create(key_number) ⇒ Object



1873
1874
1875
1876
1877
1878
1879
1880
1881
# File 'lib/resolv.rb', line 1873

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)
  self.const_set(:"Key#{key_number}", c)
  ClassHash[key_name] = ClassHash[key_number] = c
  return c
end

.decode(msg) ⇒ Object

:nodoc:



1869
1870
1871
# File 'lib/resolv.rb', line 1869

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

Instance Method Details

#encode(msg) ⇒ Object

:nodoc:



1865
1866
1867
# File 'lib/resolv.rb', line 1865

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