Class: NetworkInterface
- Inherits:
-
Object
- Object
- NetworkInterface
- Defined in:
- lib/resources/interface.rb
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(iface) ⇒ NetworkInterface
constructor
A new instance of NetworkInterface.
-
#speed ⇒ Object
returns link speed in Mbits/sec.
- #to_s ⇒ Object
- #up? ⇒ Boolean
Constructor Details
#initialize(iface) ⇒ NetworkInterface
Returns a new instance of NetworkInterface.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/resources/interface.rb', line 17 def initialize(iface) @iface = iface @interface_provider = nil if inspec.os.linux? @interface_provider = LinuxInterface.new(inspec) elsif inspec.os.windows? @interface_provider = WindowsInterface.new(inspec) else return skip_resource 'The `interface` resource is not supported on your OS yet.' end end |
Instance Method Details
#exists? ⇒ Boolean
30 31 32 |
# File 'lib/resources/interface.rb', line 30 def exists? !interface_info.nil? && !interface_info[:name].nil? end |
#speed ⇒ Object
returns link speed in Mbits/sec
39 40 41 |
# File 'lib/resources/interface.rb', line 39 def speed interface_info.nil? ? nil : interface_info[:speed] end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/resources/interface.rb', line 43 def to_s "Interface #{@iface}" end |
#up? ⇒ Boolean
34 35 36 |
# File 'lib/resources/interface.rb', line 34 def up? interface_info.nil? ? false : interface_info[:up] end |