Class: Inspec::Resources::ImmutableFlagCheck
- Inherits:
-
Object
- Object
- Inspec::Resources::ImmutableFlagCheck
- Defined in:
- lib/inspec/resources/file.rb
Overview
Helper class for immutable matcher.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#inspec ⇒ Object
readonly
Returns the value of attribute inspec.
Instance Method Summary collapse
- #find_utility_or_error(utility_name) ⇒ Object
-
#initialize(inspec, file) ⇒ ImmutableFlagCheck
constructor
A new instance of ImmutableFlagCheck.
Constructor Details
#initialize(inspec, file) ⇒ ImmutableFlagCheck
Returns a new instance of ImmutableFlagCheck.
413 414 415 416 |
# File 'lib/inspec/resources/file.rb', line 413 def initialize(inspec, file) @inspec = inspec @file_path = file.path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
412 413 414 |
# File 'lib/inspec/resources/file.rb', line 412 def file_path @file_path end |
#inspec ⇒ Object (readonly)
Returns the value of attribute inspec.
412 413 414 |
# File 'lib/inspec/resources/file.rb', line 412 def inspec @inspec end |
Instance Method Details
#find_utility_or_error(utility_name) ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/inspec/resources/file.rb', line 418 def find_utility_or_error(utility_name) [ "/usr/sbin/#{utility_name}", "/sbin/#{utility_name}", "/usr/bin/#{utility_name}", "/bin/#{utility_name}", "#{utility_name}", ].each do |cmd| return cmd if inspec.command(cmd).exist? end raise Inspec::Exceptions::ResourceFailed, "Could not find `#{utility_name}`" end |