Class: Inspec::Resources::Bridge
- Inherits:
-
Object
- Object
- Inspec::Resources::Bridge
- Defined in:
- lib/inspec/resources/bridge.rb
Instance Method Summary collapse
- #exists? ⇒ Boolean
- #has_interface?(interface) ⇒ Boolean
-
#initialize(bridge_name) ⇒ Bridge
constructor
A new instance of Bridge.
- #interfaces ⇒ Object
- #resource_id ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(bridge_name) ⇒ Bridge
Returns a new instance of Bridge.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/inspec/resources/bridge.rb', line 21 def initialize(bridge_name) @bridge_name = bridge_name @bridge_provider = nil if inspec.os.linux? @bridge_provider = LinuxBridge.new(inspec) elsif inspec.os.windows? @bridge_provider = WindowsBridge.new(inspec) else skip_resource "The `bridge` resource is not supported on your OS yet." end end |
Instance Method Details
#exists? ⇒ Boolean
34 35 36 |
# File 'lib/inspec/resources/bridge.rb', line 34 def exists? !bridge_info.nil? && !bridge_info[:name].nil? end |
#has_interface?(interface) ⇒ Boolean
38 39 40 41 42 |
# File 'lib/inspec/resources/bridge.rb', line 38 def has_interface?(interface) return skip_resource "The `bridge` resource does not provide interface detection for Windows yet" if inspec.os.windows? bridge_info.nil? ? false : bridge_info[:interfaces].include?(interface) end |
#interfaces ⇒ Object
44 45 46 |
# File 'lib/inspec/resources/bridge.rb', line 44 def interfaces bridge_info.nil? ? nil : bridge_info[:interfaces] end |
#resource_id ⇒ Object
48 49 50 |
# File 'lib/inspec/resources/bridge.rb', line 48 def resource_id @bridge_name || "bridge" end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/inspec/resources/bridge.rb', line 52 def to_s "Bridge #{@bridge_name}" end |