Class: VORuby::Simple::Parameters::Position
- Defined in:
- lib/voruby/simple/parameters.rb
Overview
Represents a position on the sky.
Instance Method Summary collapse
-
#dec(dec = nil) ⇒ Object
Set or get the value of the declination.
-
#initialize(ra, dec) ⇒ Position
constructor
A new instance of Position.
-
#ra(ra = nil) ⇒ Object
Set or get the value of the right ascension.
-
#to_s ⇒ Object
Convert the position to its SIAP-compliant form.
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_s ⇒ Object
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 |