Class: VORuby::Simple::Parameters::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/simple/parameters.rb

Overview

Represents a position on the sky.

Instance Method Summary collapse

Constructor Details

#initialize(ra, dec) ⇒ Position

Returns a new instance of Position.



154
155
156
157
# File 'lib/voruby/simple/parameters.rb', line 154

def initialize(ra, dec)
 ra(ra)
 dec(dec)
end

Instance Method Details

#dec(dec = nil) ⇒ Object

Set or get the value of the declination. The declination may be a decimal or a string in standard sexigesimal format.



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/voruby/simple/parameters.rb', line 175

def dec(dec=nil)
 if dec == nil
   return @dec
 else
   if dec.instance_of?(Declination)
     @dec = dec
   else
     @dec = Declination.new(dec)
   end
 end
end

#ra(ra = nil) ⇒ Object

Set or get the value of the right ascension. The RA may be a decimal or a string in standard sexigesimal format.



161
162
163
164
165
166
167
168
169
170
171
# File 'lib/voruby/simple/parameters.rb', line 161

def ra(ra=nil)
 if ra == nil
   return @ra
 else
   if ra.instance_of?(RightAscension)
     @ra = ra
   else
     @ra = RightAscension.new(ra)
   end
 end
end

#to_sObject

Convert the position to its SIAP-compliant form.



188
189
190
# File 'lib/voruby/simple/parameters.rb', line 188

def to_s
 URI.escape(sprintf("POS=%.3f,%.3f", @ra.ra(), @dec.dec()))
end