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

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

Overview

“mandatory” SvcParam – Mandatory keys in service binding RR

Constant Summary collapse

KeyName =
:mandatory
KeyNumber =
0

Constants inherited from Gem::Resolv::DNS::SvcParam

ClassHash

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Resolv::DNS::SvcParam

key_name, key_number

Constructor Details

#initialize(keys) ⇒ Mandatory

Initialize “mandatory” ScvParam.



1888
1889
1890
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1888

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

Instance Attribute Details

#keysObject (readonly)

Mandatory keys.



1883
1884
1885
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1883

def keys
  @keys
end

Class Method Details

.decode(msg) ⇒ Object

:nodoc:



1898
1899
1900
1901
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1898

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:



1892
1893
1894
1895
1896
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1892

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