Class: Dhalang::UrlUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/Dhalang/url_utils.rb

Overview

Contains common logic for URL's.

Class Method Summary collapse

Class Method Details

.validate(url) ⇒ Object

Raises an error if the given URL cannot be used for navigation with Puppeteer.

Parameters:

  • url (String)

    The url to validate



8
9
10
11
12
# File 'lib/Dhalang/url_utils.rb', line 8

def self.validate(url)
    if (url !~ URI::DEFAULT_PARSER.regexp[:ABS_URI])
        raise URI::InvalidURIError, 'The given url was invalid, use format http://www.example.com'
    end
end