Sha256: acde28294995a13a513840038650ea92ebbac09034f3c1e31f6bf1f4c61b905f

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

require "sys/uname"

module Fontist
  module Utils
    module System
      def self.user_os # rubocop:disable Metrics/MethodLength
        @user_os ||= begin
          host_os = RbConfig::CONFIG["host_os"]
          case host_os
          when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
            :windows
          when /darwin|mac os/
            :macos
          when /linux/
            :linux
          when /solaris|bsd/
            :unix
          else
            raise Fontist::Error, "unknown os: #{host_os.inspect}"
          end
        end
      end

      def self.user_os_with_version
        "#{user_os}-#{Sys::Uname.release}"
      end

      def self.match?(platform)
        user_os_with_version.start_with?(platform)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fontist-1.13.2 lib/fontist/utils/system.rb
fontist-1.13.1 lib/fontist/utils/system.rb
fontist-1.13.0 lib/fontist/utils/system.rb
fontist-1.12.0 lib/fontist/utils/system.rb