Class: Jschematic::Attributes::Format::Cidr
- Inherits:
-
Object
- Object
- Jschematic::Attributes::Format::Cidr
show all
- Includes:
- Element
- Defined in:
- lib/jschematic/attributes/format.rb
Instance Attribute Summary
Attributes included from Element
#id, #parent
Instance Method Summary
collapse
Methods included from Element
#required?, #schema_for, #title, #to_s
Instance Method Details
#accepts?(addr_with_cidr) ⇒ Boolean
51
52
53
54
55
|
# File 'lib/jschematic/attributes/format.rb', line 51
def accepts?(addr_with_cidr)
addr, cidr = addr_with_cidr.split("/")
return false unless cidr && (1..32).include?(cidr.to_i)
IpAddress.new.accepts?(addr)
end
|