Class: Linux::Ip::Addr::Interface
- Inherits:
-
Object
- Object
- Linux::Ip::Addr::Interface
- Defined in:
- lib/linux/ip/addr.rb
Instance Attribute Summary collapse
-
#ips ⇒ Object
readonly
Returns the value of attribute ips.
-
#mac_address ⇒ Object
Returns the value of attribute mac_address.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_ip(ip) ⇒ Object
- #as_commands(direction) ⇒ Object
-
#initialize(name) ⇒ Interface
constructor
A new instance of Interface.
Constructor Details
#initialize(name) ⇒ Interface
Returns a new instance of Interface.
10 11 12 13 |
# File 'lib/linux/ip/addr.rb', line 10 def initialize(name) @name = name @ips = [] end |
Instance Attribute Details
#ips ⇒ Object (readonly)
Returns the value of attribute ips.
9 10 11 |
# File 'lib/linux/ip/addr.rb', line 9 def ips @ips end |
#mac_address ⇒ Object
Returns the value of attribute mac_address.
8 9 10 |
# File 'lib/linux/ip/addr.rb', line 8 def mac_address @mac_address end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/linux/ip/addr.rb', line 9 def name @name end |
Instance Method Details
#add_ip(ip) ⇒ Object
14 15 16 17 |
# File 'lib/linux/ip/addr.rb', line 14 def add_ip(ip) @ips << ip self end |
#as_commands(direction) ⇒ Object
18 19 20 21 22 |
# File 'lib/linux/ip/addr.rb', line 18 def as_commands(direction) @ips.map do |ip| "ip addr #{direction} #{ip} dev #{name}" end end |