Sha256: fa0bad428ddab762ccf1050e0f6654b8f6c8f10c0fa9acf3efc050bd95c378b4

Contents?: true

Size: 733 Bytes

Versions: 3

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

require "iniparse"

module Zypper
  module Onlinesearch
    #
    # Current release classification.
    #
    class Release
      def initialize
        @filename = File.exist?("/etc/SuSE-release") ? "/etc/SuSE-release" : "/etc/os-release"
        @ini = IniParse.parse(File.read(@filename))
      end

      def name
        ini["NAME"].delete('"')
      end

      def version
        ini["VERSION"].delete('"')
      end

      def id
        ini["ID"].delete('"')
      end

      def pretty_name
        ini["PRETTY_NAME"].delete('"')
      end

      def arch
        `uname -i`.strip.chomp.to_sym
      end

      private

      def ini
        @ini["__anonymous__"]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zypper-onlinesearch-1.2.0 lib/zypper/onlinesearch/release.rb
zypper-onlinesearch-1.1.1 lib/zypper/onlinesearch/release.rb
zypper-onlinesearch-1.1.0 lib/zypper/onlinesearch/release.rb