Class: Resolv::DNS::SvcParam::Mandatory

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

Overview

“mandatory” SvcParam – Mandatory keys in service binding RR

Constant Summary collapse

KeyName =
:mandatory
KeyNumber =
0

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(keys) ⇒ Mandatory

Initialize “mandatory” ScvParam.



1900
1901
1902
# File 'lib/resolv.rb', line 1900

def initialize(keys)
  @keys = keys.map(&:to_int)
end

Instance Attribute Details

#keysObject (readonly)

Mandatory keys.



1895
1896
1897
# File 'lib/resolv.rb', line 1895

def keys
  @keys
end

Class Method Details

.decode(msg) ⇒ Object

:nodoc:



1910
1911
1912
1913
# File 'lib/resolv.rb', line 1910

def self.decode(msg) # :nodoc:
  keys = msg.get_list { msg.get_unpack('n')[0] }
  return self.new(keys)
end

Instance Method Details

#encode(msg) ⇒ Object

:nodoc:



1904
1905
1906
1907
1908
# File 'lib/resolv.rb', line 1904

def encode(msg) # :nodoc:
  @keys.sort.each do |key|
    msg.put_pack('n', key)
  end
end