Class: VORuby::ADQL::UserDefinedFunction
- Inherits:
-
ScalarExpression
- Object
- SelectionItem
- ScalarExpression
- VORuby::ADQL::UserDefinedFunction
- Defined in:
- lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb
Overview
Represents user defined function expressions.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
Attributes inherited from ScalarExpression
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, params = nil) ⇒ UserDefinedFunction
constructor
A new instance of UserDefinedFunction.
- #to_adqls ⇒ Object
- #to_s ⇒ Object
Methods inherited from ScalarExpression
Constructor Details
#initialize(name, params = nil) ⇒ UserDefinedFunction
Returns a new instance of UserDefinedFunction.
2590 2591 2592 2593 |
# File 'lib/voruby/adql/adql.rb', line 2590 def initialize(name, params=nil) self.name = name self.params = params end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2587 2588 2589 |
# File 'lib/voruby/adql/adql.rb', line 2587 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
2588 2589 2590 |
# File 'lib/voruby/adql/adql.rb', line 2588 def params @params end |
Class Method Details
.from_xml(node) ⇒ Object
2612 2613 2614 2615 2616 2617 2618 2619 2620 |
# File 'lib/voruby/adql/adql.rb', line 2612 def self.from_xml(node) name = REXML::XPath.first(node, 'Name').text params = [] node.elements.each('Params') do |param_node| params.push(ScalarExpression.from_xml(param_node)) end params = nil if params.size < 1 return UserDefinedFunction.new(name, params) end |
Instance Method Details
#to_adqls ⇒ Object
539 540 541 542 543 544 545 |
# File 'lib/voruby/adql/transforms.rb', line 539 def to_adqls params = '' if self.params and self.params.size > 0 params = self.params.collect{|x| x.to_adqls}.join(', ') end "#{self.name}(#{params})" end |
#to_s ⇒ Object
2607 2608 2609 2610 |
# File 'lib/voruby/adql/adql.rb', line 2607 def to_s params = self.params.collect{|x| x.to_s}.join('|') "{name=#{self.name},params=#{params}}" end |