Module: EasyType::Validators::IPAddress

Defined in:
lib/easy_type/validators.rb

Overview

This validator validates if it is valid IP adress

Examples:


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

Raises:

  • (Puppet::Error)

    when the name is invalid

Class Method Summary collapse

Class Method Details

.unsafe_validate(value) ⇒ Object



132
133
134
135
# File 'lib/easy_type/validators.rb', line 132

def unsafe_validate(value)
  return if value == 'absent'
  fail Puppet::Error, "#{value} is not valid as a IP address" unless value =~ Resolv::AddressRegex
end