Class: VORuby::ADQL::MathFunction

Inherits:
FunctionType show all
Defined in:
lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb

Overview

Represents a math function.

Instance Attribute Summary collapse

Attributes inherited from ScalarExpression

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScalarExpression

#is_scalar?

Constructor Details

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

Returns a new instance of MathFunction.



571
572
573
574
575
# File 'lib/voruby/adql/adql.rb', line 571

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

Instance Attribute Details

#allowObject

Returns the value of attribute allow.



569
570
571
# File 'lib/voruby/adql/adql.rb', line 569

def allow
  @allow
end

#argObject

Returns the value of attribute arg.



569
570
571
# File 'lib/voruby/adql/adql.rb', line 569

def arg
  @arg
end

#nameObject

Returns the value of attribute name.



569
570
571
# File 'lib/voruby/adql/adql.rb', line 569

def name
  @name
end

Class Method Details

.from_xml(node) ⇒ Object



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

def self.from_xml(node)
  name = MathFunctionName.from_xml(node)
  arg_node = REXML::XPath.first(node, 'Arg')
  arg = Arg.from_xml(arg_node)
  allow_node = REXML::XPath.first(node, 'Allow')
  allow = nil
  if allow_node
    allow = Allow.from_xml(allow_node)
  end
  return MathFunction.new(name, arg, allow)
end

Instance Method Details

#to_adqlsObject



127
128
129
130
131
132
133
# File 'lib/voruby/adql/transforms.rb', line 127

def to_adqls
  if self.allow
	  "#{self.name.to_adqls}(#{self.allow.to_adqls} #{self.arg.to_adqls})"
  else
	  "#{self.name.to_adqls}(#{self.arg.to_adqls})" 
  end
end

#to_sObject



609
610
611
# File 'lib/voruby/adql/adql.rb', line 609

def to_s
  "{name=#{self.name},arg=#{self.arg},allow=#{self.allow}}"
end