Class: WPAR::Network
- Inherits:
-
Object
- Object
- WPAR::Network
- Defined in:
- lib/wpars/network.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#broadcast ⇒ Object
Returns the value of attribute broadcast.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#mask_prefix ⇒ Object
Returns the value of attribute mask_prefix.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(params) ⇒ Network
constructor
A new instance of Network.
- #wpar_attributes ⇒ Object
Constructor Details
#initialize(params) ⇒ Network
10 11 12 13 14 15 16 |
# File 'lib/wpars/network.rb', line 10 def initialize(params) @name = params[:name] @interface = params[:interface] @address = params[:address] @mask_prefix = params[:mask_prefix] @broadcast = params[:broadcast] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
8 9 10 |
# File 'lib/wpars/network.rb', line 8 def address @address end |
#broadcast ⇒ Object
Returns the value of attribute broadcast.
8 9 10 |
# File 'lib/wpars/network.rb', line 8 def broadcast @broadcast end |
#interface ⇒ Object
Returns the value of attribute interface.
8 9 10 |
# File 'lib/wpars/network.rb', line 8 def interface @interface end |
#mask_prefix ⇒ Object
Returns the value of attribute mask_prefix.
8 9 10 |
# File 'lib/wpars/network.rb', line 8 def mask_prefix @mask_prefix end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/wpars/network.rb', line 7 def name @name end |
Instance Method Details
#empty? ⇒ Boolean
18 19 20 |
# File 'lib/wpars/network.rb', line 18 def empty? wpar_attributes.all?{|k,v| self.send(k).nil?} end |
#wpar_attributes ⇒ Object
22 23 24 25 |
# File 'lib/wpars/network.rb', line 22 def wpar_attributes attrs = Network.instance_methods(false) - [:name, :command, :state, :empty?, :wpar_attributes ] attrs - attrs.grep(/=$/) end |