Class: Resolv::DNS::Resource::LOC
- Inherits:
-
Resolv::DNS::Resource
- Object
- Query
- Resolv::DNS::Resource
- Resolv::DNS::Resource::LOC
- Defined in:
- lib/resolv.rb
Overview
Location resource
Constant Summary collapse
- TypeValue =
:nodoc:
29
Constants inherited from Resolv::DNS::Resource
ClassHash, ClassInsensitiveTypes, ClassValue
Instance Attribute Summary collapse
-
#altitude ⇒ Object
readonly
The altitude of the LOC above a reference sphere whose surface sits 100km below the WGS84 spheroid in centimeters as an unsigned 32bit integer.
-
#hprecision ⇒ Object
readonly
The horizontal precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g.
-
#latitude ⇒ Object
readonly
The latitude for this LOC where 2**31 is the equator in thousandths of an arc second as an unsigned 32bit integer.
-
#longitude ⇒ Object
readonly
The longitude for this LOC where 2**31 is the prime meridian in thousandths of an arc second as an unsigned 32bit integer.
-
#ssize ⇒ Object
readonly
The spherical size of this LOC in meters using scientific notation as 2 integers of XeY.
-
#version ⇒ Object
readonly
Returns the version value for this LOC record which should always be 00.
-
#vprecision ⇒ Object
readonly
The vertical precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g.
Attributes inherited from Resolv::DNS::Resource
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#encode_rdata(msg) ⇒ Object
:nodoc:.
-
#initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude) ⇒ LOC
constructor
A new instance of LOC.
Methods inherited from Resolv::DNS::Resource
Constructor Details
#initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude) ⇒ LOC
Returns a new instance of LOC.
2053 2054 2055 2056 2057 2058 2059 2060 2061 |
# File 'lib/resolv.rb', line 2053 def initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude) @version = version @ssize = Resolv::LOC::Size.create(ssize) @hprecision = Resolv::LOC::Size.create(hprecision) @vprecision = Resolv::LOC::Size.create(vprecision) @latitude = Resolv::LOC::Coord.create(latitude) @longitude = Resolv::LOC::Coord.create(longitude) @altitude = Resolv::LOC::Alt.create(altitude) end |
Instance Attribute Details
#altitude ⇒ Object (readonly)
The altitude of the LOC above a reference sphere whose surface sits 100km below the WGS84 spheroid in centimeters as an unsigned 32bit integer
2104 2105 2106 |
# File 'lib/resolv.rb', line 2104 def altitude @altitude end |
#hprecision ⇒ Object (readonly)
The horizontal precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g. 2m = +/-1m
2079 2080 2081 |
# File 'lib/resolv.rb', line 2079 def hprecision @hprecision end |
#latitude ⇒ Object (readonly)
The latitude for this LOC where 2**31 is the equator in thousandths of an arc second as an unsigned 32bit integer
2092 2093 2094 |
# File 'lib/resolv.rb', line 2092 def latitude @latitude end |
#longitude ⇒ Object (readonly)
The longitude for this LOC where 2**31 is the prime meridian in thousandths of an arc second as an unsigned 32bit integer
2098 2099 2100 |
# File 'lib/resolv.rb', line 2098 def longitude @longitude end |
#ssize ⇒ Object (readonly)
The spherical size of this LOC in meters using scientific notation as 2 integers of XeY
2072 2073 2074 |
# File 'lib/resolv.rb', line 2072 def ssize @ssize end |
#version ⇒ Object (readonly)
Returns the version value for this LOC record which should always be 00
2066 2067 2068 |
# File 'lib/resolv.rb', line 2066 def version @version end |
#vprecision ⇒ Object (readonly)
The vertical precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g. 2m = +/-1m
2086 2087 2088 |
# File 'lib/resolv.rb', line 2086 def vprecision @vprecision end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc:
2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 |
# File 'lib/resolv.rb', line 2117 def self.decode_rdata(msg) # :nodoc: version = msg.get_bytes(1) ssize = msg.get_bytes(1) hprecision = msg.get_bytes(1) vprecision = msg.get_bytes(1) latitude = msg.get_bytes(4) longitude = msg.get_bytes(4) altitude = msg.get_bytes(4) return self.new( version, Resolv::LOC::Size.new(ssize), Resolv::LOC::Size.new(hprecision), Resolv::LOC::Size.new(vprecision), Resolv::LOC::Coord.new(latitude,"lat"), Resolv::LOC::Coord.new(longitude,"lon"), Resolv::LOC::Alt.new(altitude) ) end |
Instance Method Details
#encode_rdata(msg) ⇒ Object
:nodoc:
2107 2108 2109 2110 2111 2112 2113 2114 2115 |
# File 'lib/resolv.rb', line 2107 def encode_rdata(msg) # :nodoc: msg.put_bytes(@version) msg.put_bytes(@ssize.scalar) msg.put_bytes(@hprecision.scalar) msg.put_bytes(@vprecision.scalar) msg.put_bytes(@latitude.coordinates) msg.put_bytes(@longitude.coordinates) msg.put_bytes(@altitude.altitude) end |