Method: Mongo::Srv::Resolver#get_txt_options_string
- Defined in:
- lib/mongo/srv/resolver.rb
#get_txt_options_string(hostname) ⇒ nil | String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Obtains the TXT records of a host.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/mongo/srv/resolver.rb', line 132 def (hostname) records = @resolver.getresources(hostname, Resolv::DNS::Resource::IN::TXT) if records.empty? return nil end if records.length > 1 msg = "Only one TXT record is allowed: querying hostname #{hostname} returned #{records.length} records" raise Error::InvalidTXTRecord, msg end records[0].strings.join end |