Class: Ipv4Network
- Inherits:
- 
      BasicNetworkType
      
        - Object
- BasicNetworkType
- Ipv4Network
 
- Defined in:
- lib/ifconfig/common/network_types.rb
Overview
Ipv4 Network type Optional Broadcast and Point to Point Arguments
Instance Attribute Summary collapse
- 
  
    
      #addr  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute addr. 
- 
  
    
      #bcast  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute bcast. 
- 
  
    
      #mask  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute mask. 
- 
  
    
      #ptp  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute ptp. 
Attributes inherited from BasicNetworkType
Instance Method Summary collapse
- 
  
    
      #initialize(addr, mask, bcast = nil, ptp = nil)  ⇒ Ipv4Network 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Ipv4Network. 
- #to_s ⇒ Object
Constructor Details
#initialize(addr, mask, bcast = nil, ptp = nil) ⇒ Ipv4Network
Returns a new instance of Ipv4Network.
| 18 19 20 21 22 23 24 25 | # File 'lib/ifconfig/common/network_types.rb', line 18 def initialize(addr,mask,bcast=nil,ptp=nil) super() @nettype = 'inet' @addr = IPAddr.new(addr) @bcast = bcast @mask = mask @ptp = ptp end | 
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
| 26 27 28 | # File 'lib/ifconfig/common/network_types.rb', line 26 def addr @addr end | 
#bcast ⇒ Object (readonly)
Returns the value of attribute bcast.
| 26 27 28 | # File 'lib/ifconfig/common/network_types.rb', line 26 def bcast @bcast end | 
#mask ⇒ Object (readonly)
Returns the value of attribute mask.
| 26 27 28 | # File 'lib/ifconfig/common/network_types.rb', line 26 def mask @mask end | 
#ptp ⇒ Object (readonly)
Returns the value of attribute ptp.
| 26 27 28 | # File 'lib/ifconfig/common/network_types.rb', line 26 def ptp @ptp end | 
Instance Method Details
#to_s ⇒ Object
| 28 29 30 31 32 33 | # File 'lib/ifconfig/common/network_types.rb', line 28 def to_s a = [" #{@nettype} Address: #{@addr}","Mask: #{@mask}"] a.push "Broadcast: #{@bcast}" unless @bcast.nil? a.push "P-t-P: #{@ptp}" unless @ptp.nil? return a.join(', ') end |