Class: VORuby::ADQL::ColumnReference

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

Overview

Represents a column.

Instance Attribute Summary collapse

Attributes inherited from ScalarExpression

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScalarExpression

#is_scalar?

Constructor Details

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

Returns a new instance of ColumnReference.



280
281
282
283
284
285
286
# File 'lib/voruby/adql/adql.rb', line 280

def initialize(table, name, xpath_name=nil)
	super("#{table}.#{name} #{xpath_name || ''}")
			
	self.table = table
	self.name = name
	self.xpath_name = xpath_name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



278
279
280
# File 'lib/voruby/adql/adql.rb', line 278

def name
  @name
end

#tableObject

Returns the value of attribute table.



278
279
280
# File 'lib/voruby/adql/adql.rb', line 278

def table
  @table
end

#xpath_nameObject

Returns the value of attribute xpath_name.



278
279
280
# File 'lib/voruby/adql/adql.rb', line 278

def xpath_name
  @xpath_name
end

Class Method Details

.from_xml(el) ⇒ Object



292
293
294
295
296
297
# File 'lib/voruby/adql/adql.rb', line 292

def self.from_xml(el)
 table = el.attributes['Table']
 name = el.attributes['Name']
 xpath = el.attributes['xpathName']
 cr = ColumnReference.new(table, name, xpath)
end

Instance Method Details

#to_adqlsObject



44
45
46
# File 'lib/voruby/adql/transforms.rb', line 44

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

#to_adqlx(element_name) ⇒ Object



48
49
50
51
# File 'lib/voruby/adql/transforms.rb', line 48

def to_adqlx(element_name)
  "<#{element_name} Name=\"#{self.name}\" Table=\"#{self.table}\" " +
            "xsi:type=\"columnReferenceType\"/>"
end

#to_sObject



288
289
290
# File 'lib/voruby/adql/adql.rb', line 288

def to_s
	self.value
end