Sha256: 6c697c4ce4e9af135d4295aa350e3852ddb47ecb75971f8323bfe90d881d3cac

Contents?: true

Size: 718 Bytes

Versions: 4

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

require "rbconfig"

module Launchy
  module Detect
    # Internal: Determine the host operating system that Launchy is running on
    #
    class HostOs
      attr_reader :host_os
      alias to_s host_os
      alias to_str host_os

      def initialize(host_os = nil)
        @host_os = host_os

        return if @host_os

        if (@host_os = override_host_os)
          Launchy.log "Using LAUNCHY_HOST_OS override value of '#{Launchy.host_os}'"
        else
          @host_os = default_host_os
        end
      end

      def default_host_os
        ::RbConfig::CONFIG["host_os"].downcase
      end

      def override_host_os
        Launchy.host_os
      end
    end
  end
end

Version data entries

4 entries across 3 versions & 2 rubygems

Version Path
launchy-3.1.0 lib/launchy/detect/host_os.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/launchy-3.0.1/lib/launchy/detect/host_os.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/launchy-3.0.1/lib/launchy/detect/host_os.rb
launchy-3.0.1 lib/launchy/detect/host_os.rb