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 SvcParamswith 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 keyin this list.
- 
    
      #add(param)  
    
    Add the SvcParamparamto this list, overwriting the existing one with the same key.
- 
    
      #count  
    
    Get the number of SvcParamsin this list.
- 
    
      #delete(key)  
    
    Remove the SvcParamwith the givenkeyand return it.
- 
    
      #each(&block)  
    
    Enumerate the SvcParams 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 1757
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 1743
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 1764
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 1750
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 1771
def delete(key) @params.delete(canonical_key(key)) end
#each(&block)
Enumerate the SvcParams in this list.
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 1778
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 1783
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