Class: JSONSkooma::Validators::Ipv4
- Inherits:
-
Base
- Object
- Base
- JSONSkooma::Validators::Ipv4
show all
- Defined in:
- lib/json_skooma/validators/ipv4.rb
Constant Summary
collapse
- IPV4_ADDRESS =
/((25[0-5]|(2[0-4]|1\d|[1-9])?\d)\.?\b){4}/
- REGEXP =
/\A#{IPV4_ADDRESS}\z/
Class Method Summary
collapse
Methods inherited from Base
assert?, #call, inherited
Class Method Details
.call(data) ⇒ Object
10
11
12
13
|
# File 'lib/json_skooma/validators/ipv4.rb', line 10
def call(data)
match = REGEXP.match(data)
raise FormatError, "must be a valid IPv4 address" if match.nil?
end
|