Class: Kanrisuru::Core::Disk::Parser::LsblkVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/kanrisuru/core/disk/parsers/lsblk_version.rb

Class Method Summary collapse

Class Method Details

.parse(command) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/kanrisuru/core/disk/parsers/lsblk_version.rb', line 8

def self.parse(command)
  version = 0.00
  regex = Regexp.new(/\d+(?:[,.]\d+)?/)

  raise 'lsblk command not found' if command.failure?

  version = command.to_s.scan(regex)[0].to_f unless regex.match(command.to_s).nil?
  version
end