Class: VORuby::ADQL::V1_0::TrigonometricFunction

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

Overview

Represents a trigonometric 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) ⇒ TrigonometricFunction

Returns a new instance of TrigonometricFunction.



520
521
522
523
# File 'lib/voruby/adql/1.0/adql.rb', line 520

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

Class Method Details

.from_xml(xml) ⇒ Object



534
535
536
537
538
539
540
541
542
543
# File 'lib/voruby/adql/1.0/adql.rb', line 534

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



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

def self.xml_type; 'trigonometricFunctionType' end

Instance Method Details

#name=(n) ⇒ Object



525
526
527
528
529
530
531
532
# File 'lib/voruby/adql/1.0/adql.rb', line 525

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