Class: VORuby::VOTables::VOTable::Type::ContentRole
- 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
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(txt = nil) ⇒ ContentRole
constructor
- txt:
-
The content role.
- #to_s ⇒ Object
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
#value ⇒ Object (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_s ⇒ Object
239 240 241 |
# File 'lib/voruby/votables/types.rb', line 239 def to_s "{#{@value}}" end |