Class: Ip
- Inherits:
-
Object
- Object
- Ip
- Defined in:
- lib/vagrant-powerdns/includes/Ip.class.rb
Overview
Copyright © 2013 Matthias Kadenbach github.com/mattes/vagrant-dnsmasq
Constant Summary collapse
- MATCH_IP4 =
/^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$/
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ipv4) ⇒ Ip
constructor
A new instance of Ip.
- #to_s ⇒ Object
- #v4 ⇒ Object
Constructor Details
#initialize(ipv4) ⇒ Ip
Returns a new instance of Ip.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vagrant-powerdns/includes/Ip.class.rb', line 8 def initialize(ipv4) if ipv4.is_a? Ip ipv4 = ipv4.v4 end raise ArgumentError, "IPv4 '#{ipv4}' must match #{MATCH_IP4}" unless Ip::ipv4_valid?(ipv4) @ipv4 = ipv4 end |
Class Method Details
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/vagrant-powerdns/includes/Ip.class.rb', line 27 def to_s v4 end |
#v4 ⇒ Object
23 24 25 |
# File 'lib/vagrant-powerdns/includes/Ip.class.rb', line 23 def v4 @ipv4 end |