Class: Resolv::DNS::Resource::LOC
- Inherits:
-
Resource
- Object
- Resource
- Resolv::DNS::Resource::LOC
- Defined in:
- lib/resolv.rb
Overview
Location resource
Constant Summary collapse
- TypeValue =
:nodoc:
29
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.
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.
Constructor Details
#initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude) ⇒ LOC
Returns a new instance of LOC.
2581 2582 2583 2584 2585 2586 2587 2588 2589 |
# File 'lib/resolv.rb', line 2581 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
2632 2633 2634 |
# File 'lib/resolv.rb', line 2632 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
2607 2608 2609 |
# File 'lib/resolv.rb', line 2607 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
2620 2621 2622 |
# File 'lib/resolv.rb', line 2620 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
2626 2627 2628 |
# File 'lib/resolv.rb', line 2626 def longitude @longitude end |
#ssize ⇒ Object (readonly)
The spherical size of this LOC in meters using scientific notation as 2 integers of XeY
2600 2601 2602 |
# File 'lib/resolv.rb', line 2600 def ssize @ssize end |
#version ⇒ Object (readonly)
Returns the version value for this LOC record which should always be 00
2594 2595 2596 |
# File 'lib/resolv.rb', line 2594 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
2614 2615 2616 |
# File 'lib/resolv.rb', line 2614 def vprecision @vprecision end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc:
2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 |
# File 'lib/resolv.rb', line 2644 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:
2634 2635 2636 2637 2638 2639 2640 2641 2642 |
# File 'lib/resolv.rb', line 2634 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 |