Class: IpMethods::SimpleIP
- Inherits:
-
Object
- Object
- IpMethods::SimpleIP
- Includes:
- IpMethods
- Defined in:
- lib/ip_methods.rb
Constant Summary
Constants included from IpMethods
IPV4_BIT_OCTET, IPV4_BIT_WIDTH, IPV4_PATTERN
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#mask ⇒ Object
Returns the value of attribute mask.
Instance Method Summary collapse
-
#initialize(address, mask = 32) ⇒ SimpleIP
constructor
A new instance of SimpleIP.
Methods included from IpMethods
#belongs_to?, #broadcast, #broadcast_bin, #default_gateway, from_bin, #generate_ips, ip?, ip_and_mask?, mask?, #mask_bin, #net_mask, #network, #network_bin, #to_bin, to_bin, #umask_bin
Constructor Details
#initialize(address, mask = 32) ⇒ SimpleIP
Returns a new instance of SimpleIP.
93 94 95 96 97 |
# File 'lib/ip_methods.rb', line 93 def initialize(address, mask = 32) (@address, @mask) = address.split('/') @mask ||= mask @mask = @mask.to_i end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
91 92 93 |
# File 'lib/ip_methods.rb', line 91 def address @address end |
#mask ⇒ Object
Returns the value of attribute mask.
91 92 93 |
# File 'lib/ip_methods.rb', line 91 def mask @mask end |