Class: VORuby::VOTables::VOTable::Meta::Group
- 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 GROUP element.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#field_refs ⇒ Object
readonly
Returns the value of attribute field_refs.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#param_refs ⇒ Object
readonly
Returns the value of attribute param_refs.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#ucd ⇒ Object
readonly
Returns the value of attribute ucd.
-
#uType ⇒ Object
readonly
Returns the value of attribute uType.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil, ucd = nil, description = nil, field_refs = [], param_refs = [], params = [], groups = [], id = nil, ref = nil, utype = nil) ⇒ Group
constructor
- name:
-
A name to refer to the group as.
- #to_s ⇒ Object
Constructor Details
#initialize(name = nil, ucd = nil, description = nil, field_refs = [], param_refs = [], params = [], groups = [], id = nil, ref = nil, utype = nil) ⇒ Group
- name:
-
A name to refer to the group as.
- ucd:
-
The UCD used to describe the group (Type: Type::UCDType).
- description:
-
A description of the group (Type: Meta::Description).
- field_refs:
-
A list of references to fields (Type: Meta:FieldRef).
- param_refs:
-
A list of references to parameters (Type: Meta::Param).
- params:
-
A list of parameters (Type: Meta::Param).
- groups:
-
A list of subgroups (Type: Meta::Group).
- id:
-
An ID to uniquely identify the group.
- ref:
-
A reference to the “real” group.
- uType:
-
The unique Type of the group.
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/voruby/votables/meta.rb', line 246 def initialize(name=nil, ucd=nil, description=nil, field_refs=[], param_refs=[], params=[], groups=[], id=nil, ref=nil, utype=nil) Misc::TypeCheck.new(description, Meta::Description).check() @description = description field_refs.each{ |fieldref| Misc::TypeCheck.new(fieldref, Meta::FieldRef).check() } @field_refs = field_refs param_refs.each{ |paramref| Misc::TypeCheck.new(paramref, Meta::ParamRef).check() } @param_refs = param_refs params.each{ |param| Misc::TypeCheck.new(param, Meta::Param).check() } @params = params groups.each{ |group| Misc::TypeCheck.new(group, Meta::Group).check() } @groups = groups @id = id @name = name @ref = ref Misc::TypeCheck.new(ucd, Type::UCDType).check() @ucd = ucd @utype = utype end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def description @description end |
#field_refs ⇒ Object (readonly)
Returns the value of attribute field_refs.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def field_refs @field_refs end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def groups @groups end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def name @name end |
#param_refs ⇒ Object (readonly)
Returns the value of attribute param_refs.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def param_refs @param_refs end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def params @params end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def ref @ref end |
#ucd ⇒ Object (readonly)
Returns the value of attribute ucd.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def ucd @ucd end |
#uType ⇒ Object (readonly)
Returns the value of attribute uType.
223 224 225 |
# File 'lib/voruby/votables/meta.rb', line 223 def uType @uType end |
Class Method Details
.from_soap_obj(mgroups) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/voruby/votables/transforms.rb', line 163 def self.from_soap_obj(mgroups) mgroups = [mgroups] if !mgroups.respond_to?(:each) groups = [] mgroups.each do |mgroup| ucd_txt = OTable::VOTable::_find_attr_value(mgroup.__xmlattr, 'ucd') groups.push(Group.new( VOTable::_find_attr_value(mgroup.__xmlattr, 'name'), (ucd_txt == nil)? nil: Type::UCDType.new(ucd_txt), (mgroup.respond_to?(:dESCRIPTION))? Description.from_soap_obj(mgroup.dESCRIPTION): nil, (mgroup.respond_to?(:fIELDref))? FieldRef.from_soap_obj(mgroup.fIELDref): [], (mgroup.respond_to?(:pARAMref))? ParamRef.from_soap_obj(mgroup.pARAMref): [], (mgroup.respond_to?(:pARAM))? Param.from_soap_obj(mgroup.pARAM): [], (mgroup.respond_to?(:gROUP))? Group.from_soap_obj(mgroup.gROUP): [], VOTable::_find_attr_value(mgroup.__xmlattr, 'ID'), VOTable::_find_attr_value(mgroup.__xmlattr, 'ref'), VOTable::_find_attr_value(mgroup.__xmlattr, 'utype') )) end groups end |
.from_xml(node) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/voruby/votables/rexml_parser.rb', line 94 def self.from_xml(node) # Attributes id = node.attributes['ID'] if node.attributes['ID'] name = node.attributes['name'] if node.attributes['name'] ref = node.attributes['ref'] if node.attributes['ref'] ucd = Type::UCDType.new(node.attributes['ucd']) if node.attributes['ucd'] utype = node.attributes['utype'] if node.attributes['utype'] # Elements description = Meta::Description.from_xml(node.elements.to_a('DESCRIPTION').first) if node.elements['DESCRIPTION'] fieldrefs = [] node.elements.each('FIELDref'){ |fref| fieldrefs.push(Meta::FieldRef.from_xml(fref)) } paramrefs = [] node.elements.each('PARAMref'){ |pref| paramrefs.push(Meta::ParamRef.from_xml(pref)) } params = [] node.elements.each('PARAM'){ |param| params.push(Meta::Param.from_xml(param)) } groups = [] node.elements.each('GROUP'){ |group| groups.push(Meta::Group.from_xml(group)) } return self.new(name, ucd, description, fieldrefs, paramrefs, params, groups, id, ref, utype) end |
Instance Method Details
#to_s ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/voruby/votables/meta.rb', line 282 def to_s field_refs = @field_refs.collect{|x| x.to_s}.join('|') param_refs = @param_refs.collect{|x| x.to_s}.join('|') params = @params.collect{|x| x.to_s}.join('|') groups = @groups.collect{|x| x.to_s}.join('|') "{name=#{@name};ucd=#{@ucd};description=#{@description};" + "field_refs=#{field_refs};" + "param_refs=#{param_refs};" + "params=#{params};" + "groups=#{groups};" + "id=#{@id};ref=#{@ref};utype=#{@utype}}" end |