class Inspec::Resources::Mount

def count

def count
  mounted = file.mounted
  return nil if mounted.nil? || mounted.stdout.nil?
  mounted.stdout.lines.count
end

def initialize(path)

def initialize(path)
  @path = path
  @mount_manager = mount_manager_for_os
  return skip_resource 'The `mount` resource is not supported on your OS yet.' if @mount_manager.nil?
  @file = inspec.backend.file(@path)
end

def method_missing(name)

def method_missing(name)
  return nil if !file.mounted?
  mounted = file.mounted
  return nil if mounted.nil? || mounted.stdout.nil?
  line = mounted.stdout
  # if we got multiple lines, only use the last entry
  line = mounted.stdout.lines.to_a.last if mounted.stdout.lines.count > 1
  # parse content if we are on linux
  @mount_options ||= @mount_manager.parse_mount_options(line)
  @mount_options[name]
end

def mount_manager_for_os

def mount_manager_for_os
  os = inspec.os
  if os.linux?
    LinuxMounts.new(inspec)
  elsif ['freebsd'].include?(os[:family])
    BsdMounts.new(inspec)
  end
end

def mounted?

def mounted?
  file.mounted?
end

def to_s

def to_s
  "Mount #{@path}"
end