Class: VORuby::VOTables::VOTable::Data::TD
- Defined in:
- lib/voruby/votables/data.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb
Overview
A class representing the VOTable standard TD element.
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value = nil, encoding = Type::EncodingType.new('none')) ⇒ TD
constructor
- value:
-
The value of the cell data.
- #to_s ⇒ Object
Constructor Details
#initialize(value = nil, encoding = Type::EncodingType.new('none')) ⇒ TD
- value:
-
The value of the cell data.
- encoding:
-
The encoding of the cell data (type: Type::EncodingType).
102 103 104 105 106 107 |
# File 'lib/voruby/votables/data.rb', line 102 def initialize(value=nil, encoding=Type::EncodingType.new('none')) @value = value Misc::TypeCheck.new(encoding, Type::EncodingType).check() @encoding = encoding end |
Instance Attribute Details
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
96 97 98 |
# File 'lib/voruby/votables/data.rb', line 96 def encoding @encoding end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
96 97 98 |
# File 'lib/voruby/votables/data.rb', line 96 def value @value end |
Class Method Details
.from_soap_obj(mtds) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/voruby/votables/transforms.rb', line 369 def self.from_soap_obj(mtds) mtds = [mtds] if !mtds.respond_to?(:each) tds = [] mtds.each do |td| tds.push(TD.new( td, (td.respond_to?(:__xmlattr))? VOTable::_find_attr_value(td.__xmlattr, 'encoding'): Type::EncodingType.new('none') )) end tds end |
.from_xml(node) ⇒ Object
355 356 357 358 359 360 |
# File 'lib/voruby/votables/rexml_parser.rb', line 355 def self.from_xml(node) value = node.text encoding = Type::EncodingType.new(node.attributes['encoding']) if node.attributes['encoding'] return self.new(value, encoding) end |
Instance Method Details
#to_s ⇒ Object
109 110 111 |
# File 'lib/voruby/votables/data.rb', line 109 def to_s "{value=#{@value};encoding=#{@encoding}}" end |