Class: VORuby::VOTables::VOTable::Meta::FieldRef

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 FIELDref element.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ref = nil) ⇒ FieldRef

ref:

A reference to a FIELD element.



193
194
195
196
197
# File 'lib/voruby/votables/meta.rb', line 193

def initialize(ref=nil)
raise "Field reference must define a reference" if ref == nil
	
@ref = ref
end

Instance Attribute Details

#refObject (readonly)

Returns the value of attribute ref.



189
190
191
# File 'lib/voruby/votables/meta.rb', line 189

def ref
  @ref
end

Class Method Details

.from_soap_obj(mfieldrefs) ⇒ Object



189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/voruby/votables/transforms.rb', line 189

def self.from_soap_obj(mfieldrefs)
  mfieldrefs = [mfieldrefs] if !mfieldrefs.respond_to?(:each)

  fieldrefs = []
  mfieldrefs.each do |mfieldref|
    fieldrefs.push(FieldRef.new(
      VOTable::_find_attr_value(mfieldref.__xmlattr, 'ref')
    ))
  end

  fieldrefs       
end

.from_xml(node) ⇒ Object



78
79
80
81
82
# File 'lib/voruby/votables/rexml_parser.rb', line 78

def self.from_xml(node)
ref = node.attributes['ref'] if node.attributes['ref']
	
return self.new(ref)
end

Instance Method Details

#to_sObject



199
200
201
# File 'lib/voruby/votables/meta.rb', line 199

def to_s
"{#{@ref}}"
end