Class: VORuby::VOTable::V1_1::ParamRef

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

Overview

A reference to an existing Param.

Constant Summary collapse

ELEMENT_NAME =
'PARAMref'

Instance Attribute Summary

Attributes inherited from XML::Object::Base

#node

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) ⇒ ParamRef

Create an new parameter reference.

pref = ParamRef.new(:ref => 'param1')


1684
1685
1686
# File 'lib/voruby/votable/1.1/votable.rb', line 1684

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

Instance Method Details

#paramObject

Retrieve the parameter (Param) associated with the reference.



1697
1698
1699
1700
# File 'lib/voruby/votable/1.1/votable.rb', line 1697

def param
  param_node = self.node.find_first("ancestor::*/PARAM[@ID='#{self.ref}']")
  param_node ? Param.new(param_node) : nil  
end

#refObject



1688
1689
1690
# File 'lib/voruby/votable/1.1/votable.rb', line 1688

def ref
  self.node['ref']
end

#ref=(r) ⇒ Object



1692
1693
1694
# File 'lib/voruby/votable/1.1/votable.rb', line 1692

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