Class: Gem::Resolv::DNS::SvcParams
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | lib/rubygems/vendor/resolv/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/rubygems/vendor/resolv/lib/resolv.rb', line 1741
def empty? @params.empty? end
Instance Method Details
#[](key)
Get SvcParam for the given key
in this list.
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1727
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/rubygems/vendor/resolv/lib/resolv.rb', line 1748
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/rubygems/vendor/resolv/lib/resolv.rb', line 1734
def count @params.count end
#delete(key)
Remove the SvcParam
with the given key
and return it.
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1755
def delete(key) @params.delete(canonical_key(key)) end
#each(&block)
Enumerate the SvcParam
s in this list.
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1762
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/rubygems/vendor/resolv/lib/resolv.rb', line 1767
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