Class: Dnsruby::RR::HINFO
- Inherits:
-
RR
- Object
- RR
- Dnsruby::RR::HINFO
- Defined in:
- lib/dnsruby/resource/HINFO.rb
Overview
Class for DNS Host Information (HINFO) resource records.
Constant Summary collapse
Instance Attribute Summary collapse
-
#cpu ⇒ Object
The CPU type for this RR.
-
#os ⇒ Object
The operating system type for this RR.
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc: all.
Instance Method Summary collapse
-
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all.
-
#from_data(data) ⇒ Object
:nodoc: all.
-
#from_string(input) ⇒ Object
:nodoc: all.
-
#rdata_to_string ⇒ Object
:nodoc: all.
Instance Attribute Details
#cpu ⇒ Object
The CPU type for this RR.
24 25 26 |
# File 'lib/dnsruby/resource/HINFO.rb', line 24 def cpu @cpu end |
#os ⇒ Object
The operating system type for this RR.
26 27 28 |
# File 'lib/dnsruby/resource/HINFO.rb', line 26 def os @os end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc: all
65 66 67 68 69 |
# File 'lib/dnsruby/resource/HINFO.rb', line 65 def self.decode_rdata(msg) #:nodoc: all cpu = msg.get_string os = msg.get_string return self.new([cpu, os]) end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
60 61 62 63 |
# File 'lib/dnsruby/resource/HINFO.rb', line 60 def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_string(@cpu) msg.put_string(@os) end |
#from_data(data) ⇒ Object
:nodoc: all
28 29 30 |
# File 'lib/dnsruby/resource/HINFO.rb', line 28 def from_data(data) #:nodoc: all @cpu, @os= data end |
#from_string(input) ⇒ Object
:nodoc: all
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dnsruby/resource/HINFO.rb', line 32 def from_string(input) #:nodoc: all strings = TXT.parse(input) cpu = "" os = "" if (strings.length == 1) cpu, os = input.split(" ") else cpu = strings[0] os = strings[1] end cpu.sub!(/^\"/, "") @cpu = cpu.sub(/\"$/, "") os.sub!(/^\"/, "") @os = os.sub(/\"$/, "") end |
#rdata_to_string ⇒ Object
:nodoc: all
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dnsruby/resource/HINFO.rb', line 48 def rdata_to_string #:nodoc: all if (defined?@cpu) temp = [] [@cpu, @os].each {|str| output = TXT.display(str) temp.push("\"#{output}\"") } return temp.join(' ') end return '' end |