Class: VORuby::ADQL::V1_0::UnionSearch

Inherits:
Search
  • Object
show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

Represents expressions like A Or B

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(condition1, condition2) ⇒ UnionSearch

Returns a new instance of UnionSearch.



1092
1093
1094
1095
# File 'lib/voruby/adql/1.0/adql.rb', line 1092

def initialize(condition1, condition2)
  self.condition1 = condition1
  self.condition2 = condition2
end

Instance Attribute Details

#condition1Object

Returns the value of attribute condition1.



1088
1089
1090
# File 'lib/voruby/adql/1.0/adql.rb', line 1088

def condition1
  @condition1
end

#condition2Object

Returns the value of attribute condition2.



1088
1089
1090
# File 'lib/voruby/adql/1.0/adql.rb', line 1088

def condition2
  @condition2
end

Class Method Details

.from_xml(xml) ⇒ Object



1128
1129
1130
1131
1132
1133
# File 'lib/voruby/adql/1.0/adql.rb', line 1128

def self.from_xml(xml)
  root = element_from(xml)
  
  conds = REXML::XPath.match(root, 'x:Condition', {'x' => obj_ns.uri})
  self.new(xml_to_obj(conds[0]), xml_to_obj(conds[1]))
end

.xml_typeObject



1090
# File 'lib/voruby/adql/1.0/adql.rb', line 1090

def self.xml_type; 'unionSearchType' end

Instance Method Details

#==(s) ⇒ Object



1109
1110
1111
1112
# File 'lib/voruby/adql/1.0/adql.rb', line 1109

def ==(s)
  self.condition1 == s.condition1 and
  self.condition2 == s.condition2
end

#to_sObject



1114
1115
1116
# File 'lib/voruby/adql/1.0/adql.rb', line 1114

def to_s
  "#{self.condition1} OR #{self.condition2}"
end

#to_xml(name = nil) ⇒ Object



1118
1119
1120
1121
1122
1123
1124
1125
1126
# File 'lib/voruby/adql/1.0/adql.rb', line 1118

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.condition1.to_xml('Condition'))
  el.add_element(self.condition2.to_xml('Condition'))
  
  collapse_namespaces(el)
  el
end