Class: VORuby::Resolver::Sesame::ResolvedInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/resolver/sesame.rb

Overview

A simple object that represents a name resolution attempt.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ ResolvedInfo

Create a ResolvedInfo object from an appropriate XML::Node (one that represents a <Resolver> XML element).



165
166
167
# File 'lib/voruby/resolver/sesame.rb', line 165

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



161
162
163
# File 'lib/voruby/resolver/sesame.rb', line 161

def xml
  @xml
end

Instance Method Details

#aliasesObject

A list of aliases for the object. Returns a list of strings.



280
281
282
# File 'lib/voruby/resolver/sesame.rb', line 280

def aliases
  self.xml.find('alias').collect{ |a| a.content }
end

#codeObject



174
175
176
# File 'lib/voruby/resolver/sesame.rb', line 174

def code
  self.xml['code']
end

#err_de_masObject

The error of the declination in milliarcseconds.



222
223
224
# File 'lib/voruby/resolver/sesame.rb', line 222

def err_de_mas
  self.xml.find_first('errDEmas').content.to_f if self.xml.find_first('errDEmas')
end

#err_ra_masObject

The error of the right ascension in milliarcseconds.



217
218
219
# File 'lib/voruby/resolver/sesame.rb', line 217

def err_ra_mas
  self.xml.find_first('errRAmas').content.to_f if self.xml.find_first('errRAmas')
end

#err_velObject

The error in the velocity of the object in km/s.



248
249
250
# File 'lib/voruby/resolver/sesame.rb', line 248

def err_vel
  self.xml.find_first('errVel').content.to_if if self.xml.find_first('errVel')
end

#errorsObject

Any errors accompanying the name resolution. Returns an array of string.



186
187
188
# File 'lib/voruby/resolver/sesame.rb', line 186

def errors
  self.xml.find('ERROR').collect{ |e| e.content }
end

#errzObject

The error in the redshift of the object.



232
233
234
# File 'lib/voruby/resolver/sesame.rb', line 232

def errz
  self.xml.find_first('errz').content.to_i if self.xml.find_first('errz')
end

#infosObject

Any info accompanying the name resolution. Returns an array of strings.



180
181
182
# File 'lib/voruby/resolver/sesame.rb', line 180

def infos
  self.xml.find('INFO').collect{ |i| i.content }
end

#jdedegObject

The J2000 declination of the object in decimal degrees.



206
207
208
# File 'lib/voruby/resolver/sesame.rb', line 206

def jdedeg
  self.xml.find_first('jdedeg').content.to_f if self.xml.find_first('jdedeg')
end

#jposObject

The J2000 coordinates of the object in sexigesimal format (i.e. ‘13:29:52.36 +47:11:40.8’)



196
197
198
# File 'lib/voruby/resolver/sesame.rb', line 196

def jpos
  self.xml.find_first('jpos').content if self.xml.find_first('jpos')
end

#jradegObject

The J2000 right ascension of the object in decimal degrees.



201
202
203
# File 'lib/voruby/resolver/sesame.rb', line 201

def jradeg
  self.xml.find_first('jradeg').content.to_f if self.xml.find_first('jradeg')
end

#mtypeObject

The morphological type of the object (i.e. Sc).



259
260
261
# File 'lib/voruby/resolver/sesame.rb', line 259

def mtype
  self.xml.find_first('MType').content if self.xml.find_first('MType')
end

#nameObject

The name of the resolver (i.e. Simbad).



170
171
172
# File 'lib/voruby/resolver/sesame.rb', line 170

def name
  self.xml['name']
end

#nrefsObject

The number of references to this object.



274
275
276
# File 'lib/voruby/resolver/sesame.rb', line 274

def nrefs
  self.xml.find_first('nrefs').content.to_i if self.xml.find_first('nrefs')
end

#onameObject

The canonical name of the object.



269
270
271
# File 'lib/voruby/resolver/sesame.rb', line 269

def oname
  self.xml.find_first('oname').content if self.xml.find_first('oname')
end

#otypeObject

The classification of the object (i.e. Seyfert_2 or QSO).



191
192
193
# File 'lib/voruby/resolver/sesame.rb', line 191

def otype
  self.xml.find_first('otype').content if self.xml.find_first('otype')
end

#position(as = :degrees) ⇒ Object

The J2000 position of the object in degrees or sexigesimal format.

info.position(:degrees)     # => [202.4682083, 47.1946667]
info.position(:sexigesimal) # => ['13:29:52.36', '+47:11:40.8']


287
288
289
290
291
292
293
# File 'lib/voruby/resolver/sesame.rb', line 287

def position(as=:degrees)
  case as
  when :sexigesimal        then (self.jpos || '').split(/\s+/)
  else
    [self.jradeg, self.jdedeg]
  end
end

#ref_posObject

A bibcode that corresponds to the publication in which the position of the object was determined.



212
213
214
# File 'lib/voruby/resolver/sesame.rb', line 212

def ref_pos
  self.xml.find_first('refPos').content if self.xml.find_first('refPos')
end

#ref_velObject

A bibcode that corresponds to the publication in which the velocity of the object was determined.



254
255
256
# File 'lib/voruby/resolver/sesame.rb', line 254

def ref_vel
  self.xml.find_first('refVel').content if self.xml.find_first('refVel')
end

#refzObject

A bibcode that corresponds to the publication in which the redshift of the object was determined.



238
239
240
# File 'lib/voruby/resolver/sesame.rb', line 238

def refz
  self.xml.find_first('refz').content if self.xml.find_first('refz')
end

#sptypeObject

The spectral type of the object (i.e. A10)



264
265
266
# File 'lib/voruby/resolver/sesame.rb', line 264

def sptype
  self.xml.find_first('spType').content if self.xml.find_first('spType')
end

#velObject

The velocity of the object in km/s.



243
244
245
# File 'lib/voruby/resolver/sesame.rb', line 243

def vel
  self.xml.find_first('Vel').content.to_f if self.xml.find_first('Vel')
end

#zObject

The redshift of the object.



227
228
229
# File 'lib/voruby/resolver/sesame.rb', line 227

def z
  self.xml.find_first('z').content.to_f if self.xml.find_first('z')
end