Class: VORuby::ADQL::V1_0::Having

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

Overview

Represents the Having expression part of a query

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(condition) ⇒ Having

Returns a new instance of Having.



1556
1557
1558
# File 'lib/voruby/adql/1.0/adql.rb', line 1556

def initialize(condition)
  self.condition = condition
end

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



1552
1553
1554
# File 'lib/voruby/adql/1.0/adql.rb', line 1552

def condition
  @condition
end

Class Method Details

.from_xml(xml) ⇒ Object



1583
1584
1585
1586
1587
1588
1589
# File 'lib/voruby/adql/1.0/adql.rb', line 1583

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



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

def self.xml_type; 'havingType' end

Instance Method Details

#==(h) ⇒ Object



1566
1567
1568
# File 'lib/voruby/adql/1.0/adql.rb', line 1566

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

#to_sObject



1570
1571
1572
# File 'lib/voruby/adql/1.0/adql.rb', line 1570

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

#to_xml(name = nil) ⇒ Object



1574
1575
1576
1577
1578
1579
1580
1581
# File 'lib/voruby/adql/1.0/adql.rb', line 1574

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