Class: Xen::Vif
- Inherits:
-
Object
- Object
- Xen::Vif
- Defined in:
- lib/xen/config.rb
Overview
Virtual Network Interface
Instance Attribute Summary collapse
-
#bridge ⇒ Object
Returns the value of attribute bridge.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#vifname ⇒ Object
Returns the value of attribute vifname.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Vif
constructor
A new instance of Vif.
- #to_str ⇒ Object
Constructor Details
#initialize(*args) ⇒ Vif
Returns a new instance of Vif.
93 94 95 96 97 98 99 |
# File 'lib/xen/config.rb', line 93 def initialize(*args) = args. @ip = [:ip] @mac = [:mac] @bridge = [:bridge] @vifname = [:vifname] end |
Instance Attribute Details
#bridge ⇒ Object
Returns the value of attribute bridge.
92 93 94 |
# File 'lib/xen/config.rb', line 92 def bridge @bridge end |
#ip ⇒ Object
Returns the value of attribute ip.
92 93 94 |
# File 'lib/xen/config.rb', line 92 def ip @ip end |
#mac ⇒ Object
Returns the value of attribute mac.
92 93 94 |
# File 'lib/xen/config.rb', line 92 def mac @mac end |
#vifname ⇒ Object
Returns the value of attribute vifname.
92 93 94 |
# File 'lib/xen/config.rb', line 92 def vifname @vifname end |
Class Method Details
.from_str(value) ⇒ Object
101 102 103 104 |
# File 'lib/xen/config.rb', line 101 def self.from_str(value) = value.scan(/(\w+)=([^,]+)/).inject({}){ |m, (k, v)| m[k.to_sym] = v; m } new() end |
Instance Method Details
#to_str ⇒ Object
106 107 108 109 110 |
# File 'lib/xen/config.rb', line 106 def to_str %w(ip mac bridge vifname).collect { |key| "#{key}=#{instance_variable_get('@' + key)}" if !instance_variable_get('@'+key).nil? }.compact.join(',') end |