Class: VORuby::ADQL::V1_0::UnaryExpr
- Inherits:
-
ScalarExpression
- Object
- SelectionItem
- ScalarExpression
- VORuby::ADQL::V1_0::UnaryExpr
- Defined in:
- lib/voruby/adql/1.0/adql.rb
Overview
Represents an unary expression such as -(a.ra)
Instance Attribute Summary collapse
-
#arg ⇒ Object
Returns the value of attribute arg.
-
#oper ⇒ Object
Returns the value of attribute oper.
Class Method Summary collapse
Instance Method Summary collapse
- #==(e) ⇒ Object
-
#initialize(oper, arg) ⇒ UnaryExpr
constructor
A new instance of UnaryExpr.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(oper, arg) ⇒ UnaryExpr
Returns a new instance of UnaryExpr.
151 152 153 154 155 |
# File 'lib/voruby/adql/1.0/adql.rb', line 151 def initialize(oper, arg) super() self.oper = oper self.arg = arg end |
Instance Attribute Details
#arg ⇒ Object
Returns the value of attribute arg.
147 148 149 |
# File 'lib/voruby/adql/1.0/adql.rb', line 147 def arg @arg end |
#oper ⇒ Object
Returns the value of attribute oper.
147 148 149 |
# File 'lib/voruby/adql/1.0/adql.rb', line 147 def oper @oper end |
Class Method Details
.from_xml(xml) ⇒ Object
191 192 193 194 195 196 197 198 |
# File 'lib/voruby/adql/1.0/adql.rb', line 191 def self.from_xml(xml) root = element_from(xml) self.new( UnaryOperator.new(root.attributes.get_attribute_ns(obj_ns.uri, 'Oper').value), xml_to_obj(REXML::XPath.first(root, 'x:Arg', {'x' => obj_ns.uri})) ) end |
.xml_type ⇒ Object
149 |
# File 'lib/voruby/adql/1.0/adql.rb', line 149 def self.xml_type; 'unaryExprType' end |
Instance Method Details
#==(e) ⇒ Object
186 187 188 189 |
# File 'lib/voruby/adql/1.0/adql.rb', line 186 def ==(e) self.oper == e.oper and self.arg == e.arg end |
#to_s ⇒ Object
182 183 184 |
# File 'lib/voruby/adql/1.0/adql.rb', line 182 def to_s "#{self.oper}(#{self.arg})" end |
#to_xml(name = nil) ⇒ Object
172 173 174 175 176 177 178 179 180 |
# File 'lib/voruby/adql/1.0/adql.rb', line 172 def to_xml(name=nil) el = super(name) el.attributes["#{obj_ns.prefix}:Oper"] = self.oper.to_s el.add_element(self.arg.to_xml('Arg')) collapse_namespaces(el) el end |