Class: VORuby::ADQL::V1_0::MathFunction

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

Overview

Represents a math 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) ⇒ MathFunction

Returns a new instance of MathFunction.



559
560
561
562
# File 'lib/voruby/adql/1.0/adql.rb', line 559

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

Class Method Details

.from_xml(xml) ⇒ Object



573
574
575
576
577
578
579
580
581
582
# File 'lib/voruby/adql/1.0/adql.rb', line 573

def self.from_xml(xml)
  root = element_from(xml)
  
  allow_el = REXML::XPath.first(root, 'x:Allow', {'x' => obj_ns.uri})
  self.new(
    MathFunctionName.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



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

def self.xml_type; 'mathFunctionType' end

Instance Method Details

#name=(n) ⇒ Object



564
565
566
567
568
569
570
571
# File 'lib/voruby/adql/1.0/adql.rb', line 564

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