Class: VORuby::VOTables::VOTable::Meta::Max

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/meta.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb

Overview

A class representing the standard VOTable MAX element.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil, inclusive = Type::YesNo.new('yes')) ⇒ Max

value:

The maximum value of a quantity.

inclusive:

Whether the value is inclusive (Type: Type::YesNo).



723
724
725
726
727
728
729
730
# File 'lib/voruby/votables/meta.rb', line 723

def initialize(value=nil, inclusive=Type::YesNo.new('yes'))
raise "Max must have a value" if value == nil
	
@value = value
	
Misc::TypeCheck.new(inclusive, Type::YesNo).check()
@inclusive = inclusive
end

Instance Attribute Details

#inclusiveObject (readonly)

Returns the value of attribute inclusive.



717
718
719
# File 'lib/voruby/votables/meta.rb', line 717

def inclusive
  @inclusive
end

#valueObject (readonly)

Returns the value of attribute value.



717
718
719
# File 'lib/voruby/votables/meta.rb', line 717

def value
  @value
end

Class Method Details

.from_soap_obj(mmax) ⇒ Object



322
323
324
325
326
327
328
329
# File 'lib/voruby/votables/transforms.rb', line 322

def self.from_soap_obj(mmax)
  inclusive_txt = VOTable::_find_attr_value(mmax.__xmlattr, 'inclusive') || 'yes'

  Max.new(
    VOTable::_find_attr_value(mmax.__xmlattr, 'value'),
    Type::YesNo.new(inclusive_txt)
  )        
end

.from_xml(node) ⇒ Object



303
304
305
306
307
308
# File 'lib/voruby/votables/rexml_parser.rb', line 303

def self.from_xml(node)
value = node.attributes['node'] if node.attributes['node']
inclusive = Type::YesNo.new(node.attributes['inclusive']) if node.attributes['inclusive']
	
return self.new(value, inclusive)
end

Instance Method Details

#to_sObject



732
733
734
# File 'lib/voruby/votables/meta.rb', line 732

def to_s
"{value=#{@value};inclusive=#{@inclusive}}"
end