Class: VORuby::VOTable::V1_1::Data
- Inherits:
-
Base
- Object
- XML::Object::Base
- Base
- VORuby::VOTable::V1_1::Data
- Defined in:
- lib/voruby/votable/1.1/votable.rb
Overview
The actual tabular data.
Constant Summary collapse
- ELEMENT_NAME =
'DATA'
Instance Attribute Summary
Attributes inherited from XML::Object::Base
Instance Method Summary collapse
-
#format ⇒ Object
Retrieve the formatted data.
-
#format=(f) ⇒ Object
Set the formatted data.
-
#initialize(defn = nil) ⇒ Data
constructor
Create a new body of data.
Methods inherited from Base
#==, element_name, #get_element, #xpath_for
Methods inherited from XML::Object::Base
#==, element_name, from_file, #to_s
Constructor Details
Instance Method Details
#format ⇒ Object
Retrieve the formatted data. May be TableData, Binary or Fits.
1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 |
# File 'lib/voruby/votable/1.1/votable.rb', line 1718 def format format_node = self.node.find_first("#{xpath_for(TableData)}|#{xpath_for(Binary)}|#{xpath_for(Fits)}") return nil if !format_node case format_node.name when 'TABLEDATA' then TableData.new(format_node) when 'BINARY' then Binary.new(format_node) when 'FITS' then Fits.new(format_node) else nil end end |
#format=(f) ⇒ Object
Set the formatted data. Must be one of the allowed data formats–TableData, Binary or Fits.
1732 1733 1734 1735 1736 1737 1738 1739 |
# File 'lib/voruby/votable/1.1/votable.rb', line 1732 def format=(f) raise 'Data format must be one of TableData, Binary or Fits' if ![TableData, Binary, Fits].include?(f.class) self.node.each_child do |c| c.remove! end set_element(f.class, f) end |