Class: VORuby::VOTable::V1_1::Group

Inherits:
Base show all
Defined in:
lib/voruby/votable/1.1/votable.rb

Overview

A way of grouping fields which are logically connected, like a value and its error.

Constant Summary collapse

ELEMENT_NAME =
'GROUP'

Instance Attribute Summary

Attributes inherited from XML::Object::Base

#node

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, element_name, #get_element, #xpath_for

Methods inherited from XML::Object::Base

#==, element_name, from_file, #to_s

Constructor Details

#initialize(defn = nil) ⇒ Group

Create a new group.

 group = Group.new(
   :name => 'Velocity',
   :description => Description.new(:text => 'Velocity and its error')
   :field_refs => [FieldRef.new(:ref => 'col4'), FieldRef.new(:ref => 'col5')]
)


1532
1533
1534
# File 'lib/voruby/votable/1.1/votable.rb', line 1532

def initialize(defn=nil)
  super(defn)
end

Class Method Details

.serialization_orderObject



1519
1520
1521
1522
1523
1524
# File 'lib/voruby/votable/1.1/votable.rb', line 1519

def self.serialization_order
  [
    :description, :field_refs, :params, :param_refs, :groups,
    :id, :name, :ref, :ucd, :utype
  ]
end

Instance Method Details

#descriptionObject

Retrieve the description (Description).



1579
1580
1581
# File 'lib/voruby/votable/1.1/votable.rb', line 1579

def description
  get_element(Description)
end

#description=(d) ⇒ Object

Set the description (Description).



1584
1585
1586
# File 'lib/voruby/votable/1.1/votable.rb', line 1584

def description=(d)
  set_element(Description, d)
end

#field_refsObject

Retrieve the references to fields. Returns a HomogeneousNodeList.



1590
1591
1592
# File 'lib/voruby/votable/1.1/votable.rb', line 1590

def field_refs
  HomogeneousNodeList.new(self.node, xpath_for(FieldRef), FieldRef)
end

#field_refs=(refs) ⇒ Object

Set the references to fields. group.field_refs = [FieldRef.new(), …]



1596
1597
1598
# File 'lib/voruby/votable/1.1/votable.rb', line 1596

def field_refs=(refs)
  self.field_refs.replace(refs)
end

#groupsObject

Retrieve any sub-groups. Returns a HomogeneousNodeList.



1628
1629
1630
# File 'lib/voruby/votable/1.1/votable.rb', line 1628

def groups
  HomogeneousNodeList.new(self.node, xpath_for(Group), Group)
end

#groups=(grps) ⇒ Object

Set any sub-groups.

group.groups = [Group.new(), ...]


1634
1635
1636
# File 'lib/voruby/votable/1.1/votable.rb', line 1634

def groups=(grps)
  self.groups.replace(grps)
end

#idObject



1536
1537
1538
# File 'lib/voruby/votable/1.1/votable.rb', line 1536

def id
  self.node['ID']
end

#id=(i) ⇒ Object



1540
1541
1542
# File 'lib/voruby/votable/1.1/votable.rb', line 1540

def id=(i)
  @node['ID'] = i.to_s
end

#nameObject



1544
1545
1546
# File 'lib/voruby/votable/1.1/votable.rb', line 1544

def name
  self.node['name']
end

#name=(n) ⇒ Object



1548
1549
1550
# File 'lib/voruby/votable/1.1/votable.rb', line 1548

def name=(n)
  @node['name'] = n.to_s
end

#param_refsObject

Retrieve the references to parameters. Returns a HomogeneousNodeList.



1602
1603
1604
# File 'lib/voruby/votable/1.1/votable.rb', line 1602

def param_refs
  HomogeneousNodeList.new(self.node, xpath_for(ParamRef), ParamRef)
end

#param_refs=(refs) ⇒ Object

Set the the references to parameters.

group.param_refs = [ParamRef.new(), ...]


1608
1609
1610
# File 'lib/voruby/votable/1.1/votable.rb', line 1608

def param_refs=(refs)
  self.param_refs.replace(refs)
end

#paramsObject

Retrieve the list of parameters. Normally one would use #param_refs instead. Returns a HomogeneousNodeList.



1615
1616
1617
# File 'lib/voruby/votable/1.1/votable.rb', line 1615

def params
  HomogeneousNodeList.new(self.node, xpath_for(Param), Param)
end

#params=(parameters) ⇒ Object

Set the list parameters. Normally one would use #param_refs= instead.

group.params = [Param.new(), ...]


1622
1623
1624
# File 'lib/voruby/votable/1.1/votable.rb', line 1622

def params=(parameters)
  self.params.replace(parameters)
end

#refObject



1552
1553
1554
# File 'lib/voruby/votable/1.1/votable.rb', line 1552

def ref
  self.node['ref']
end

#ref=(r) ⇒ Object



1556
1557
1558
# File 'lib/voruby/votable/1.1/votable.rb', line 1556

def ref=(r)
  @node['ref'] = r.to_s
end

#ucdObject



1560
1561
1562
# File 'lib/voruby/votable/1.1/votable.rb', line 1560

def ucd
  self.node['ucd']
end

#ucd=(u) ⇒ Object

Set the unified content descriptor or UCD.



1565
1566
1567
# File 'lib/voruby/votable/1.1/votable.rb', line 1565

def ucd=(u)
  @node['ucd'] = u.to_s
end

#utypeObject



1569
1570
1571
# File 'lib/voruby/votable/1.1/votable.rb', line 1569

def utype
  self.node['utype']
end

#utype=(u) ⇒ Object

Set the utype (i.e. the role of the column in the context of an external data model).



1574
1575
1576
# File 'lib/voruby/votable/1.1/votable.rb', line 1574

def utype=(u)
  @node['utype'] = u.to_s
end