Class: VORuby::VOTables::VOTable::Data::Data
- Defined in:
- lib/voruby/votables/data.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb
Overview
A class representing the VOTable standard DATA element.
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(format = nil) ⇒ Data
constructor
- format:
-
Where the actual data is coming from (types: FITSStream, BinaryStream, TableData. Currently, this class doesn’t know what to do with streams..
- #to_s ⇒ Object
Constructor Details
#initialize(format = nil) ⇒ Data
- format:
-
Where the actual data is coming from (types: FITSStream, BinaryStream, TableData. Currently, this class doesn’t know what to do with streams.
160 161 162 163 164 165 166 167 168 |
# File 'lib/voruby/votables/data.rb', line 160 def initialize(format=nil) if format.is_a?(FITSStream) or format.is_a?(BinaryStream) or format.is_a?(TableData) @format = format else raise "Format #{format.class} is not valid. Use one of: " + "FITSStream, BinaryStream, TableData" end end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
154 155 156 |
# File 'lib/voruby/votables/data.rb', line 154 def format @format end |
Class Method Details
.from_soap_obj(mdata) ⇒ Object
337 338 339 340 341 342 |
# File 'lib/voruby/votables/transforms.rb', line 337 def self.from_soap_obj(mdata) # Note that strictly one can also have a FITS or BINARY stream here Data.new( (mdata.respond_to?(:tABLEDATA))? TableData.from_soap_obj(mdata.tABLEDATA): nil ) end |
.from_xml(node) ⇒ Object
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/voruby/votables/rexml_parser.rb', line 386 def self.from_xml(node) format = nil node.elements.each('FITS'){ |fnode| format = FITSStream.from_xml(fnode) } node.elements.each('BINARY'){ |bnode| format = BinaryStream.from_xml(bode) } node.elements.each('TABLEDATA'){ |tnode| format = TableData.from_xml(tnode) } return self.new(format) end |
Instance Method Details
#to_s ⇒ Object
170 171 172 |
# File 'lib/voruby/votables/data.rb', line 170 def to_s "{format=#{@format}}" end |