Class: OpenGraphy::UrlValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/open_graphy/url_validator.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


7
8
9
# File 'lib/open_graphy/url_validator.rb', line 7

def valid?
 !!(@url =~ /\A#{URI::regexp(['http', 'https'])}\z/)
end