Class: OBIX::Types::URI
Instance Method Summary collapse
-
#cast(value) ⇒ Object
Cast the given value to a URI.
Methods inherited from Type
Constructor Details
This class inherits a constructor from OBIX::Types::Type
Instance Method Details
#cast(value) ⇒ Object
Cast the given value to a URI.
value - Any object that responds to ‘to_s`.
Returns a string.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/obix/types/uri.rb', line 13 def cast value parent = @element.parent if parent url = ::URI.join parent.href, value else url = ::URI.join "#{OBIX.configuration.scheme}://#{OBIX.configuration.host}", value end url.to_s end |