Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 OS Detection via Ruby
#4
Or just use the short version of it. No need to credit me since it only excludes insignificant details not really needed to run the script

Code:
class OSError < StandardError
end
module OS_Detect
  def self.execute
    @os ||= case RUBY_PLATFORM
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      :windows
    when /darwin|mac os/
      :macosx
    when /linux/
      :linux
    when /solaris|bsd/
      :unix
    else
      raise OSError, "unknown os: #{RUBY_PLATFORM.inspect}"
    end
  end
end

I had to replace the error message he provided because it would cause you to read a non related error message instead! Laughing Something like NameError: No Error class or module found. Laughing + Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Messages In This Thread
OS Detection via Ruby - by DerVVulfman - 09-08-2019, 07:56 PM
RE: OS Detection via Ruby - by kyonides - 09-09-2019, 12:31 AM
RE: OS Detection via Ruby - by DerVVulfman - 09-09-2019, 03:44 AM
RE: OS Detection via Ruby - by DerVVulfman - 09-10-2019, 03:40 AM
RE: OS Detection via Ruby - by kyonides - 09-09-2019, 05:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   AKM Add-On #1: NF Key State Detection DerVVulfman 0 4,321 03-05-2008, 06:39 AM
Last Post: DerVVulfman



Users browsing this thread: