Class: VORuby::STC::V1_30::STCRegionList

Inherits:
STCMetadataType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Type for STC Region list.

Defined Under Namespace

Classes: RegionList

Instance Attribute Summary collapse

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from STCMetadataType

stc_metadata_from_xml

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(coord_sys, regions, options = {}) ⇒ STCRegionList

Returns a new instance of STCRegionList.



8616
8617
8618
8619
8620
# File 'lib/voruby/stc/1.30/stc.rb', line 8616

def initialize(coord_sys, regions, options={})
  super(options)
  self.coord_sys = coord_sys
  self.regions = regions
end

Instance Attribute Details

#coord_sysObject

Returns the value of attribute coord_sys.



8614
8615
8616
# File 'lib/voruby/stc/1.30/stc.rb', line 8614

def coord_sys
  @coord_sys
end

#regionsObject

Returns the value of attribute regions.



8614
8615
8616
# File 'lib/voruby/stc/1.30/stc.rb', line 8614

def regions
  @regions
end

Class Method Details

.from_xml(xml) ⇒ Object



8653
8654
8655
8656
8657
8658
8659
8660
8661
# File 'lib/voruby/stc/1.30/stc.rb', line 8653

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    xml_to_obj(root, AstroCoordSystem, true),
    RegionList.new(xml_to_obj(root, Region)),
    *STCMetadataType.(root)
  )
end

Instance Method Details

#==(r) ⇒ Object



8637
8638
8639
8640
8641
# File 'lib/voruby/stc/1.30/stc.rb', line 8637

def ==(r)
  super(r) and
  self.coord_sys == r.coord_sys and
  self.regions == r.regions
end

#to_xml(name = nil) ⇒ Object



8643
8644
8645
8646
8647
8648
8649
8650
8651
# File 'lib/voruby/stc/1.30/stc.rb', line 8643

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.coord_sys.to_xml)
  self.regions.each{ |r| el.add_element(r.to_xml) }
  
  collapse_namespaces(el)
  el
end