Class: VORuby::ADQL::V1_0::AliasSelectionItem
- Inherits:
-
SelectionItem
- Object
- SelectionItem
- VORuby::ADQL::V1_0::AliasSelectionItem
- Defined in:
- lib/voruby/adql/1.0/adql.rb
Overview
Used to select an expression as a new alias column
Instance Attribute Summary collapse
-
#as ⇒ Object
Returns the value of attribute as.
-
#expression ⇒ Object
Returns the value of attribute expression.
Class Method Summary collapse
Instance Method Summary collapse
- #==(a) ⇒ Object
-
#initialize(expression, as = nil) ⇒ AliasSelectionItem
constructor
A new instance of AliasSelectionItem.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(expression, as = nil) ⇒ AliasSelectionItem
Returns a new instance of AliasSelectionItem.
694 695 696 697 |
# File 'lib/voruby/adql/1.0/adql.rb', line 694 def initialize(expression, as=nil) self.expression = expression self.as = as end |
Instance Attribute Details
#as ⇒ Object
Returns the value of attribute as.
690 691 692 |
# File 'lib/voruby/adql/1.0/adql.rb', line 690 def as @as end |
#expression ⇒ Object
Returns the value of attribute expression.
690 691 692 |
# File 'lib/voruby/adql/1.0/adql.rb', line 690 def expression @expression end |
Class Method Details
.from_xml(xml) ⇒ Object
730 731 732 733 734 735 736 737 738 |
# File 'lib/voruby/adql/1.0/adql.rb', line 730 def self.from_xml(xml) root = element_from(xml) as = root.attributes.get_attribute_ns(obj_ns.uri, 'As') self.new( xml_to_obj(REXML::XPath.first(root, 'x:Expression', {'x' => obj_ns.uri})), as ? as.value : nil ) end |
.xml_type ⇒ Object
692 |
# File 'lib/voruby/adql/1.0/adql.rb', line 692 def self.xml_type; 'aliasSelectionItemType' end |
Instance Method Details
#==(a) ⇒ Object
709 710 711 712 |
# File 'lib/voruby/adql/1.0/adql.rb', line 709 def ==(a) self.expression == a.expression and self.as == a.as end |
#to_s ⇒ Object
714 715 716 717 718 |
# File 'lib/voruby/adql/1.0/adql.rb', line 714 def to_s a = self.expression.to_s a = "#{a} AS #{as}" if self.as a end |
#to_xml(name = nil) ⇒ Object
720 721 722 723 724 725 726 727 728 |
# File 'lib/voruby/adql/1.0/adql.rb', line 720 def to_xml(name=nil) el = super(name) el.attributes["#{obj_ns.prefix}:As"] = self.as if self.as el.add_element(self.expression.to_xml('Expression')) collapse_namespaces(el) el end |