Class: Resolv::DNS::SvcParams
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | lib/resolv.rb |
Overview
SvcParams
for service binding RRs. [RFC9460]
Class Method Summary
-
.new(params = []) ⇒ SvcParams
constructor
Create a list of
SvcParams
with the given initial content. - .decode(msg) Internal use only
Instance Attribute Summary
-
#empty? ⇒ Boolean
readonly
Get whether this list is empty.
Instance Method Summary
-
#[](key)
Get SvcParam for the given
key
in this list. -
#add(param)
Add the
SvcParam
param
to this list, overwriting the existing one with the same key. -
#count
Get the number of
SvcParams
in this list. -
#delete(key)
Remove the
SvcParam
with the givenkey
and return it. -
#each(&block)
Enumerate the
SvcParam
s in this list. - #encode(msg) Internal use only
- #canonical_key(key) private Internal use only
Constructor Details
.new(params = []) ⇒ SvcParams
Class Method Details
.decode(msg)
This method is for internal use only.
[ GitHub ]
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
Get whether this list is empty.
# File 'lib/resolv.rb', line 1754
def empty? @params.empty? end
Instance Method Details
#[](key)
Get SvcParam for the given key
in this list.
# File 'lib/resolv.rb', line 1740
def [](key) @params[canonical_key(key)] end
#add(param)
Add the SvcParam
param
to this list, overwriting the existing one with the same key.
# File 'lib/resolv.rb', line 1761
def add(param) @params[param.class.key_number] = param end
#canonical_key(key) (private)
This method is for internal use only.
[ GitHub ]
#count
Get the number of SvcParams
in this list.
# File 'lib/resolv.rb', line 1747
def count @params.count end
#delete(key)
Remove the SvcParam
with the given key
and return it.
# File 'lib/resolv.rb', line 1768
def delete(key) @params.delete(canonical_key(key)) end
#each(&block)
Enumerate the SvcParam
s in this list.
# File 'lib/resolv.rb', line 1775
def each(&block) return enum_for(:each) unless block @params.each_value(&block) end
#encode(msg)
This method is for internal use only.
[ GitHub ]
# File 'lib/resolv.rb', line 1780
def encode(msg) # :nodoc: @params.keys.sort.each do |key| msg.put_pack('n', key) msg.put_length16 do @params.fetch(key).encode(msg) end end end