Class: Inspec::Resources::FileSystemResource
- Inherits:
-
Object
- Object
- Inspec::Resources::FileSystemResource
- Defined in:
- lib/resources/filesystem.rb
Instance Attribute Summary collapse
-
#partition ⇒ Object
readonly
Returns the value of attribute partition.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(partition) ⇒ FileSystemResource
constructor
A new instance of FileSystemResource.
- #name ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(partition) ⇒ FileSystemResource
Returns a new instance of FileSystemResource.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/resources/filesystem.rb', line 19 def initialize(partition) @partition = partition @cache = nil # select file system manager @fsman = nil os = inspec.os if os.linux? @fsman = LinuxFileSystemResource.new(inspec) elsif os.windows? @fsman = WindowsFileSystemResource.new(inspec) else raise Inspec::Exceptions::ResourceSkipped, 'The `filesystem` resource is not supported on your OS yet.' end end |
Instance Attribute Details
#partition ⇒ Object (readonly)
Returns the value of attribute partition.
17 18 19 |
# File 'lib/resources/filesystem.rb', line 17 def partition @partition end |
Instance Method Details
#info ⇒ Object
35 36 37 38 39 |
# File 'lib/resources/filesystem.rb', line 35 def info return @cache if !@cache.nil? return {} if @fsman.nil? @cache = @fsman.info(@partition) end |
#name ⇒ Object
55 56 57 58 |
# File 'lib/resources/filesystem.rb', line 55 def name info = @fsman.info(@partition) info[:name] end |
#size ⇒ Object
45 46 47 48 |
# File 'lib/resources/filesystem.rb', line 45 def size info = @fsman.info(@partition) info[:size] end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/resources/filesystem.rb', line 41 def to_s "FileSystem #{@partition}" end |
#type ⇒ Object
50 51 52 53 |
# File 'lib/resources/filesystem.rb', line 50 def type info = @fsman.info(@partition) info[:type] end |