Class: VORuby::ADQL::BinaryExpr
- Inherits:
-
ScalarExpression
- Object
- SelectionItem
- ScalarExpression
- VORuby::ADQL::BinaryExpr
- Defined in:
- lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb
Overview
Represents a binary expression such as a+b.
Instance Attribute Summary collapse
-
#arg1 ⇒ Object
Returns the value of attribute arg1.
-
#arg2 ⇒ Object
Returns the value of attribute arg2.
-
#oper ⇒ Object
Returns the value of attribute oper.
Attributes inherited from ScalarExpression
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(arg1, oper, arg2) ⇒ BinaryExpr
constructor
A new instance of BinaryExpr.
- #to_adqls ⇒ Object
- #to_s ⇒ Object
Methods inherited from ScalarExpression
Constructor Details
#initialize(arg1, oper, arg2) ⇒ BinaryExpr
Returns a new instance of BinaryExpr.
157 158 159 160 161 162 163 |
# File 'lib/voruby/adql/adql.rb', line 157 def initialize(arg1, oper, arg2) super("#{arg1} #{oper} #{arg2}") self.arg1 = arg1 self.arg2 = arg2 self.oper = oper end |
Instance Attribute Details
#arg1 ⇒ Object
Returns the value of attribute arg1.
155 156 157 |
# File 'lib/voruby/adql/adql.rb', line 155 def arg1 @arg1 end |
#arg2 ⇒ Object
Returns the value of attribute arg2.
155 156 157 |
# File 'lib/voruby/adql/adql.rb', line 155 def arg2 @arg2 end |
#oper ⇒ Object
Returns the value of attribute oper.
155 156 157 |
# File 'lib/voruby/adql/adql.rb', line 155 def oper @oper end |
Class Method Details
.from_xml(node) ⇒ Object
199 200 201 202 203 204 205 |
# File 'lib/voruby/adql/adql.rb', line 199 def self.from_xml(node) oper = BinaryOperator.new(node.attributes['Oper']) arg1_node, arg2_node = node.elements.to_a('Arg') arg1 = ScalarExpression.from_xml(arg1_node) arg2 = ScalarExpression.from_xml(arg2_node) return BinaryExpr.new(arg1, oper, arg2) end |
Instance Method Details
#to_adqls ⇒ Object
26 27 28 |
# File 'lib/voruby/adql/transforms.rb', line 26 def to_adqls "#{self.arg1.to_adqls} #{self.oper.to_adqls} #{self.arg2.to_adqls}" end |
#to_s ⇒ Object
195 196 197 |
# File 'lib/voruby/adql/adql.rb', line 195 def to_s "{arg1=#{self.arg1},oper=#{self.oper},arg2=#{self.arg2}}" end |