Class: KafoWizards::Entries::IPAddressEntry

Inherits:
StringEntry show all
Defined in:
lib/kafo_wizards/entries/ip_address.rb

Direct Known Subclasses

NetmaskEntry

Instance Attribute Summary

Attributes inherited from AbstractEntry

#default_value, #description, #label, #name, #parent, #post_hook, #pre_hook, #validators, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StringEntry

#initialize

Methods inherited from AbstractEntry

#call_post_hook, #call_pre_hook, descendants, #display_type, inherited, #initialize, #required?, #update

Constructor Details

This class inherits a constructor from KafoWizards::Entries::StringEntry

Class Method Details

.entry_typeObject



11
12
13
# File 'lib/kafo_wizards/entries/ip_address.rb', line 11

def self.entry_type
  :ip_address
end

Instance Method Details

#validate(value) ⇒ Object



4
5
6
7
8
9
# File 'lib/kafo_wizards/entries/ip_address.rb', line 4

def validate(value)
  if !(value =~ Resolv::IPv4::Regex)
    raise KafoWizards::ValidationError.new("#{value} is not valid IP address")
  end
  value
end