Class: VORuby::VOTables::VOTable::Meta::Definitions

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/meta.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb

Overview

A class representing the standard VOTable DEFINITIONS element.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coosys = [], params = []) ⇒ Definitions

coosys:

A list of coordinate systems (Type: Meta::CooSys).

params:

A list of parameters (Type: Meta::Param).



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/voruby/votables/meta.rb', line 35

def initialize(coosys=[], params=[])
coosys.each{ |sys|
 Misc::TypeCheck.new(sys, Meta::CooSys).check()
}  
@coosys = coosys
	
params.each{ |param|
 Misc::TypeCheck.new(param, Meta::Param).check()
}
@params = params
end

Instance Attribute Details

#coosysObject (readonly)

Returns the value of attribute coosys.



29
30
31
# File 'lib/voruby/votables/meta.rb', line 29

def coosys
  @coosys
end

#paramsObject (readonly)

Returns the value of attribute params.



29
30
31
# File 'lib/voruby/votables/meta.rb', line 29

def params
  @params
end

Class Method Details

.from_soap_obj(mdef) ⇒ Object



22
23
24
25
26
27
# File 'lib/voruby/votables/transforms.rb', line 22

def self.from_soap_obj(mdef)
  Definitions.new(
     (mdef.respond_to?(:cOOSYS))? VOTable._coosys_from_soap_obj(mdef.cOOSYS): nil,
     (mdef.respond_to?(:pARAM))? VOTable._params_from_soap_obj(mdef.pARAM): nil
   )
end

.from_xml(node) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/voruby/votables/rexml_parser.rb', line 15

def self.from_xml(node)
systems = []
node.elements.each('COOSYS'){ |sysNode|
 systems.push(Meta::CooSys.from_xml(sysNode))
}
	
params = []
node.elements.each('PARAM'){ |paramNode|
 params.push(Meta::Param.from_xml(paramNode))
}
	
return self.new(systems, params)
end

Instance Method Details

#to_sObject



47
48
49
50
51
52
# File 'lib/voruby/votables/meta.rb', line 47

def to_s
coosys = @coosys.collect{|x| x.to_s}.join('|')
params = @params.collect{|x| x.to_s}.join('|')
	
"coosys=#{coosys};params=#{params}"
end