Class: MCollective::Validator::Ipv6addressValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/mcollective/validator/ipv6address_validator.rb

Class Method Summary collapse

Class Method Details

.validate(validator) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/mcollective/validator/ipv6address_validator.rb', line 6

def self.validate(validator)
  begin
    ip = IPAddr.new(validator)
    raise ValidatorError, "value should be an ipv6 adddress" unless ip.ipv6?
  rescue
    raise ValidatorError, "value should be an ipv6 address"
  end
end