Class: VORuby::ADQL::V1_0::Where

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

Overview

Represents the Where part of the query

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(condition) ⇒ Where

Returns a new instance of Where.



1654
1655
1656
# File 'lib/voruby/adql/1.0/adql.rb', line 1654

def initialize(condition)
  self.condition = condition
end

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



1650
1651
1652
# File 'lib/voruby/adql/1.0/adql.rb', line 1650

def condition
  @condition
end

Class Method Details

.from_xml(xml) ⇒ Object



1681
1682
1683
1684
1685
1686
1687
# File 'lib/voruby/adql/1.0/adql.rb', line 1681

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    xml_to_obj(REXML::XPath.first(root, 'x:Condition', {'x' => obj_ns.uri}))
  )
end

.xml_typeObject



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

def self.xml_type; 'whereType' end

Instance Method Details

#==(w) ⇒ Object



1664
1665
1666
# File 'lib/voruby/adql/1.0/adql.rb', line 1664

def ==(w)
  self.condition == w.condition
end

#to_sObject



1668
1669
1670
# File 'lib/voruby/adql/1.0/adql.rb', line 1668

def to_s
  "WHERE #{self.condition}"
end

#to_xml(name = nil) ⇒ Object



1672
1673
1674
1675
1676
1677
1678
1679
# File 'lib/voruby/adql/1.0/adql.rb', line 1672

def to_xml(name=nil)
  el = element_root(name)
  
  el.add_element(self.condition.to_xml('Condition'))
  
  collapse_namespaces(el)
  el
end