Module: Merritt::Util
- Defined in:
- lib/merritt/util.rb
Overview
Miscellaneous utility methods
Class Method Summary collapse
-
.to_uri(url) ⇒ nil, URI
Ensures that the specified argument is a URI.
Class Method Details
.to_uri(url) ⇒ nil, URI
Ensures that the specified argument is a URI.
11 12 13 14 15 16 |
# File 'lib/merritt/util.rb', line 11 def to_uri(url) return nil unless url return url if url.is_a? URI stripped = url.respond_to?(:strip) ? url.strip : url.to_s.strip URI.parse(stripped) end |