Class: VORuby::ADQL::V1_0::ColumnReference

Inherits:
ScalarExpression show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

Represents a column

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(table, name, xpath_name = nil) ⇒ ColumnReference

Returns a new instance of ColumnReference.



207
208
209
210
211
212
# File 'lib/voruby/adql/1.0/adql.rb', line 207

def initialize(table, name, xpath_name=nil)
  super()
  self.table = table
  self.name = name
  self.xpath_name = xpath_name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



203
204
205
# File 'lib/voruby/adql/1.0/adql.rb', line 203

def name
  @name
end

#tableObject

Returns the value of attribute table.



203
204
205
# File 'lib/voruby/adql/1.0/adql.rb', line 203

def table
  @table
end

#xpath_nameObject

Returns the value of attribute xpath_name.



203
204
205
# File 'lib/voruby/adql/1.0/adql.rb', line 203

def xpath_name
  @xpath_name
end

Class Method Details

.from_xml(xml) ⇒ Object



248
249
250
251
252
253
254
255
256
257
# File 'lib/voruby/adql/1.0/adql.rb', line 248

def self.from_xml(xml)
  root = element_from(xml)
  
  xpath_name = root.attributes.get_attribute_ns(obj_ns.uri, 'xpathName')
  self.new(
    root.attributes.get_attribute_ns(obj_ns.uri, 'Table').value,
    root.attributes.get_attribute_ns(obj_ns.uri, 'Name').value,
    xpath_name ? xpath_name.value : nil
  )
end

.xml_typeObject



205
# File 'lib/voruby/adql/1.0/adql.rb', line 205

def self.xml_type; 'columnReferenceType' end

Instance Method Details

#==(r) ⇒ Object



242
243
244
245
246
# File 'lib/voruby/adql/1.0/adql.rb', line 242

def ==(r)
  self.table == r.table and
  self.name == r.name and
  self.xpath_name == r.xpath_name
end

#to_sObject



238
239
240
# File 'lib/voruby/adql/1.0/adql.rb', line 238

def to_s
  "#{self.table}.#{self.name}"
end

#to_xml(name = nil) ⇒ Object



228
229
230
231
232
233
234
235
236
# File 'lib/voruby/adql/1.0/adql.rb', line 228

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:Table"] = self.table
  el.attributes["#{obj_ns.prefix}:Name"] = self.name
  el.attributes["#{obj_ns.prefix}:xpathName"] = self.xpath_name if self.xpath_name
  
  el
end