Class: UrlAttribute::NormalizedUrl
- Defined in:
- lib/url_attribute/normalized_url.rb
Instance Attribute Summary
Attributes inherited from Url
Instance Method Summary collapse
-
#initialize(url) ⇒ NormalizedUrl
constructor
A new instance of NormalizedUrl.
Methods inherited from Url
Constructor Details
#initialize(url) ⇒ NormalizedUrl
Returns a new instance of NormalizedUrl.
3 4 5 6 7 8 9 10 11 |
# File 'lib/url_attribute/normalized_url.rb', line 3 def initialize(url) super if @uri && @uri.scheme.blank? @uri = URI.parse("http://#{url}") @url = @uri.to_s end rescue URI::InvalidURIError end |