Class: VORuby::VOTables::VOTable::Type::AnyURI
- Defined in:
- lib/voruby/votables/types.rb
Overview
A class representing a valid URI.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(txt = nil) ⇒ AnyURI
constructor
- txt:
-
A string representing a valid URI (e.g. one that Ruby’s URI.parse method recognizes..
- #to_s ⇒ Object
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
#value ⇒ Object (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_s ⇒ Object
218 219 220 |
# File 'lib/voruby/votables/types.rb', line 218 def to_s "{#{@value.to_s}}" end |