Sha256: 58f9c6d209d5b409c9a87f9c0ad057952fb0916a2b0b7751ce4027a72a68b44c
Contents?: true
Size: 742 Bytes
Versions: 8
Compression:
Stored size: 742 Bytes
Contents
require 'rbconfig' module Dirwatch module OsFetcher AVAILABLE = [ WINDOWS = :windows, MAC = :mac, LINUX = :linux, ].sort.freeze class << self def operating_system case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc|win32|dos/ WINDOWS when /darwin|mac os/ MAC when /linux/ LINUX else raise OsNotSupportedError.new host_os, AVAILABLE end end alias fetch operating_system AVAILABLE.each do |os| define_method("#{os}?") do operating_system == os end end private def host_os RbConfig::CONFIG['host_os'] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems