Class: OpenGraphy::UrlValidator
- Inherits:
-
Object
- Object
- OpenGraphy::UrlValidator
- Defined in:
- lib/open_graphy/url_validator.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ UrlValidator
constructor
A new instance of UrlValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ UrlValidator
Returns a new instance of UrlValidator.
3 4 5 |
# File 'lib/open_graphy/url_validator.rb', line 3 def initialize(url) @url = url end |
Instance Method Details
#valid? ⇒ Boolean
7 8 9 |
# File 'lib/open_graphy/url_validator.rb', line 7 def valid? !!(@url =~ /\A#{URI::regexp(['http', 'https'])}\z/) end |