Class: VORuby::VOTables::VOTable::Type::AnyURI

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

Overview

A class representing a valid URI.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(txt = nil) ⇒ AnyURI

txt:

A string representing a valid URI (e.g. one that Ruby’s URI.parse method recognizes.



210
211
212
213
214
215
216
# File 'lib/voruby/votables/types.rb', line 210

def initialize(txt=nil)
begin
 @value = URI.parse(URI.escape(txt))
rescue
 raise "URI '#{txt}' is not valid: #{$!}"
end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



205
206
207
# File 'lib/voruby/votables/types.rb', line 205

def value
  @value
end

Instance Method Details

#to_sObject



218
219
220
# File 'lib/voruby/votables/types.rb', line 218

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