ruby / 3.3 / resolv / dns / svcparams.html

class Resolv::DNS::SvcParams

Parent:
Object
Included modules:
Enumerable

SvcParams for service binding RRs. [RFC9460]

Public Class Methods

new(params = []) Show source
# File lib/resolv.rb, line 1723
def initialize(params = [])
  @params = {}

  params.each do |param|
    add param
  end
end

Create a list of SvcParams with the given initial content.

params has to be an enumerable of +SvcParam+s. If its content has +SvcParam+s with the duplicate key, the one appears last takes precedence.

Public Instance Methods

[](key) Show source
# File lib/resolv.rb, line 1734
def [](key)
  @params[canonical_key(key)]
end

Get SvcParam for the given key in this list.

add(param) Show source
# File lib/resolv.rb, line 1755
def add(param)
  @params[param.class.key_number] = param
end

Add the SvcParam param to this list, overwriting the existing one with the same key.

count() Show source
# File lib/resolv.rb, line 1741
def count
  @params.count
end

Get the number of SvcParams in this list.

delete(key) Show source
# File lib/resolv.rb, line 1762
def delete(key)
  @params.delete(canonical_key(key))
end

Remove the SvcParam with the given key and return it.

each(&block) Show source
# File lib/resolv.rb, line 1769
def each(&block)
  return enum_for(:each) unless block
  @params.each_value(&block)
end

Enumerate the +SvcParam+s in this list.

empty?() Show source
# File lib/resolv.rb, line 1748
def empty?
  @params.empty?
end

Get whether this list is empty.

Ruby Core © 1993–2022 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.