Class: VORuby::ADQL::AliasSelectionItem
- Inherits:
-
SelectionItem
- Object
- SelectionItem
- VORuby::ADQL::AliasSelectionItem
- Defined in:
- lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.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
-
#initialize(expression, as = nil) ⇒ AliasSelectionItem
constructor
A new instance of AliasSelectionItem.
- #to_adqls ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(expression, as = nil) ⇒ AliasSelectionItem
Returns a new instance of AliasSelectionItem.
726 727 728 729 |
# File 'lib/voruby/adql/adql.rb', line 726 def initialize(expression, as=nil) self.expression = expression self.as = as end |
Instance Attribute Details
#as ⇒ Object
Returns the value of attribute as.
724 725 726 |
# File 'lib/voruby/adql/adql.rb', line 724 def as @as end |
#expression ⇒ Object
Returns the value of attribute expression.
723 724 725 |
# File 'lib/voruby/adql/adql.rb', line 723 def expression @expression end |
Class Method Details
.from_xml(node) ⇒ Object
745 746 747 748 749 750 |
# File 'lib/voruby/adql/adql.rb', line 745 def self.from_xml(node) as = node.attributes['As'] expr_node = REXML::XPath.first(node, 'Expression') expr = ScalarExpression.from_xml(expr_node) return AliasSelectionItem.new(expr, as) end |
Instance Method Details
#to_adqls ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/voruby/adql/transforms.rb', line 153 def to_adqls if self.as "#{self.expression.to_adqls} AS #{self.as}" else self.expression.to_adqls end end |
#to_s ⇒ Object
741 742 743 |
# File 'lib/voruby/adql/adql.rb', line 741 def to_s "{expression=#{self.expression},as=#{self.as}}" end |