Class: ExampleResource
- Inherits:
-
Object
- Object
- ExampleResource
- Defined in:
- lib/templates/resource_pack/libraries/example.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #default_path ⇒ Object
-
#initialize(alternate_path = nil) ⇒ ExampleResource
constructor
A new instance of ExampleResource.
- #version ⇒ Object
Constructor Details
#initialize(alternate_path = nil) ⇒ ExampleResource
Returns a new instance of ExampleResource.
4 5 6 |
# File 'lib/templates/resource_pack/libraries/example.rb', line 4 def initialize(alternate_path = nil) @path = alternate_path || default_path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
16 17 18 |
# File 'lib/templates/resource_pack/libraries/example.rb', line 16 def path @path end |
Instance Method Details
#default_path ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/templates/resource_pack/libraries/example.rb', line 8 def default_path if inspec.os.windows? 'C:\example\bin\example.bat' else '/usr/bin/example' end end |
#version ⇒ Object
18 19 20 21 |
# File 'lib/templates/resource_pack/libraries/example.rb', line 18 def version raw_result = inspec.command("#{path} --version").stdout raw_result.split.first end |