Class: VORuby::ADQL::V1_0::AggregateFunction

Inherits:
Function show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

Represents an aggregate function

Instance Attribute Summary

Attributes inherited from Function

#allow, #arg, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Function

#==, #to_s, #to_xml

Methods inherited from SelectionItem

#to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(name, arg, allow = nil) ⇒ AggregateFunction

Returns a new instance of AggregateFunction.



594
595
596
597
# File 'lib/voruby/adql/1.0/adql.rb', line 594

def initialize(name, arg, allow=nil)
  super(arg, allow)
  self.name = name
end

Class Method Details

.from_xml(xml) ⇒ Object



608
609
610
611
612
613
614
615
616
617
# File 'lib/voruby/adql/1.0/adql.rb', line 608

def self.from_xml(xml)
  root = element_from(xml)
  
  allow_el = REXML::XPath.first(root, 'x:Allow', {'x' => obj_ns.uri})
  self.new(
    AggregateFunctionName.new(root.attributes.get_attribute_ns(obj_ns.uri, 'Name').value),
    xml_to_obj(REXML::XPath.first(root, 'x:Arg', {'x' => obj_ns.uri})),
    allow_el ? xml_to_obj(allow_el) : nil
  )
end

.xml_typeObject



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

def self.xml_type; 'aggregateFunctionType' end

Instance Method Details

#name=(n) ⇒ Object



599
600
601
602
603
604
605
606
# File 'lib/voruby/adql/1.0/adql.rb', line 599

def name=(n)
  raise_argument_required_error('aggregate function name') if !n
  
  n = AggregateFunctionName.new(n) if n.is_a?(::String)
  raise_type_mismatch_error(n, AggregateFunctionName)
  
  @name = n
end