class NativePackageInstaller::OSRelease
Public Class Methods
Public Instance Methods
Source
# File lib/native-package-installer/os-release.rb, line 28 def [](key) @variables[key] end
Source
# File lib/native-package-installer/os-release.rb, line 24 def each(&block) @variables.each(&block) end
Source
# File lib/native-package-installer/os-release.rb, line 36 def id_like (self["ID_LIKE"] || "").split(/ /) end
Source
# File lib/native-package-installer/os-release.rb, line 40 def version self["VERSION"] end
Private Instance Methods
Source
# File lib/native-package-installer/os-release.rb, line 45 def parse @variables = {} path = "/etc/os-release" return unless File.exist?(path) File.foreach(path) do |line| key, value = line.strip.split("=", 2) next if value.nil? if value.start_with?("\"") and value.end_with?("\"") value = value[1..-2] end @variables[key] = value end end