Class: VORuby::ADQL::V1_0::UserDefinedFunction
- Inherits:
-
ScalarExpression
- Object
- SelectionItem
- ScalarExpression
- VORuby::ADQL::V1_0::UserDefinedFunction
- Defined in:
- lib/voruby/adql/1.0/adql.rb
Overview
Represents user defined function expressions
Defined Under Namespace
Classes: ListOfScalarExpression
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
- #==(f) ⇒ Object
-
#initialize(name, params = nil) ⇒ UserDefinedFunction
constructor
A new instance of UserDefinedFunction.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(name, params = nil) ⇒ UserDefinedFunction
Returns a new instance of UserDefinedFunction.
630 631 632 633 |
# File 'lib/voruby/adql/1.0/adql.rb', line 630 def initialize(name, params=nil) self.name = name self.params = params end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
626 627 628 |
# File 'lib/voruby/adql/1.0/adql.rb', line 626 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
626 627 628 |
# File 'lib/voruby/adql/1.0/adql.rb', line 626 def params @params end |
Class Method Details
.from_xml(xml) ⇒ Object
673 674 675 676 677 678 679 680 681 682 683 684 685 |
# File 'lib/voruby/adql/1.0/adql.rb', line 673 def self.from_xml(xml) root = element_from(xml) params_el = REXML::XPath.match(root, 'x:Params', {'x' => obj_ns.uri}) params = params_el ? UserDefinedFunction::ListOfScalarExpression.new(params_el.collect{ |pel| xml_to_obj(pel) }) : nil self.new( REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri}).text, params ) end |
.xml_type ⇒ Object
628 |
# File 'lib/voruby/adql/1.0/adql.rb', line 628 def self.xml_type; 'userDefinedFunctionType' end |
Instance Method Details
#==(f) ⇒ Object
649 650 651 652 |
# File 'lib/voruby/adql/1.0/adql.rb', line 649 def ==(f) self.name == f.name and self.params == f.params end |
#to_s ⇒ Object
654 655 656 657 658 659 |
# File 'lib/voruby/adql/1.0/adql.rb', line 654 def to_s s = "#{self.name}(" s << self.params.collect{ |p| p.to_s }.join(', ') if self.params s << ')' s end |
#to_xml(name = nil) ⇒ Object
661 662 663 664 665 666 667 668 669 670 671 |
# File 'lib/voruby/adql/1.0/adql.rb', line 661 def to_xml(name=nil) el = super(name) name_el = REXML::Element.new("#{obj_ns.prefix}:Name") name_el.text = self.name el.add_element(name_el) self.params.each{ |p| el.add_element(p.to_xml('Params'))} if self.params el end |