Class: CryptReboot::Luks::VersionDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/crypt_reboot/luks/version_detector.rb

Overview

Return LUKS version or raise the exception if given file doesn’t represent a valid LUKS device

Constant Summary collapse

Error =
Class.new StandardError
NotLuks =
Class.new Error
UnsupportedVersion =
Class.new Error

Instance Method Summary collapse

Instance Method Details

#call(headevice) ⇒ Object

Raises:



11
12
13
14
15
16
17
18
19
# File 'lib/crypt_reboot/luks/version_detector.rb', line 11

def call(headevice)
  version = supported_versions.find do |tested_version|
    checker.call(headevice, tested_version)
  end
  return version if version
  raise UnsupportedVersion if checker.call(headevice)

  raise NotLuks
end