Module: EasyType::Validators::Url

Defined in:
lib/easy_type/validators.rb

Overview

This validator validates if it is valid FQDN with at least a domain name or an IP address

Examples:


newparam(:name) do
  include ::EasyType::Validators::Url

Raises:

  • (Puppet::Error)

    when the name is invalid

Class Method Summary collapse

Class Method Details

.unsafe_validate(value) ⇒ Object



204
205
206
207
# File 'lib/easy_type/validators.rb', line 204

def unsafe_validate(value)
  return if value == 'absent'
  fail Puppet::Error, "#{value} is not valid as a URL" unless value =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
end