Class: VORuby::VOTables::VOTable::Type::ContentRole

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/types.rb

Overview

A class representing the content role of a document.

Constant Summary collapse

@@roles =
['query', 'hints', 'doc', 'location']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(txt = nil) ⇒ ContentRole

txt:

The content role. Choices: query, hints, doc, location.



230
231
232
233
234
235
236
237
# File 'lib/voruby/votables/types.rb', line 230

def initialize(txt=nil)
if txt and @@roles.include?(txt)
 @value = txt
else
 raise "Content role '#{txt}' is not valid.  Use one of: " +
	  @@roles.join(', ')
end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



225
226
227
# File 'lib/voruby/votables/types.rb', line 225

def value
  @value
end

Instance Method Details

#to_sObject



239
240
241
# File 'lib/voruby/votables/types.rb', line 239

def to_s
"{#{@value}}"
end